hydrogen-upgrades

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hydrogen Upgrades

Hydrogen 升级指南

Version-by-version migration guides for upgrading Shopify Hydrogen. Each guide covers breaking changes, required code updates, and step-by-step diffs.
针对Shopify Hydrogen升级的逐版本迁移指南,每份指南都涵盖了破坏性变更、所需的代码更新以及分步差异对比。

Live Documentation

实时文档

For the latest upgrade information from Shopify:
bash
node scripts/search_shopify_docs.mjs "hydrogen upgrade <version>"
node scripts/search_shopify_docs.mjs "hydrogen breaking changes"
node scripts/search_shopify_docs.mjs "hydrogen migration"
The curated guides below cover specific version jumps with detailed diffs and Weaverse-specific considerations.
如需获取Shopify官方发布的最新升级信息:
bash
node scripts/search_shopify_docs.mjs "hydrogen upgrade <version>"
node scripts/search_shopify_docs.mjs "hydrogen breaking changes"
node scripts/search_shopify_docs.mjs "hydrogen migration"
下方整理的指南涵盖了特定版本跨度的升级内容,包含详细的差异对比以及Weaverse相关的注意事项。

Available Upgrade Guides

可用升级指南

GuideKey Changes
2024.4.7 → 2024.7.1Optimistic variants, new session commit pattern, Layout component refactor, VariantSelector improvements
2024.10.1 → 2025.1.0
v3_lazyRouteDiscovery
flag, stylesheet link tag fixes
2025.1.0 → 2025.1.1
v3_singleFetch
flag, nonce support,
json
/
defer
deprecation, B2B stabilization
2025.1.2 → 2025.1.3
v3_routeConfig
flag, Layout export moved to separate file,
routes.ts
config
2025.1.3 → 2025.1.4Session logout fix,
VariantSelector
deprecation, product query updates,
ProductForm
refactor
2025.5.0 → 2025.7.0Major — React Router 7.9.x migration, context creation, entry point updates
2025.7.0 → 2026.1.0Major
@react-router
7.12,
@shopify/hydrogen
2026.1.0, Storefront API 2026-01, new cart mutations
指南核心变更
2024.4.7 → 2024.7.1Optimistic variants、全新session commit模式、Layout组件重构、VariantSelector功能优化
2024.10.1 → 2025.1.0
v3_lazyRouteDiscovery
配置项、样式表link标签修复
2025.1.0 → 2025.1.1
v3_singleFetch
配置项、nonce支持、
json
/
defer
废弃、B2B功能稳定化
2025.1.2 → 2025.1.3
v3_routeConfig
配置项、Layout导出迁移到独立文件、
routes.ts
配置支持
2025.1.3 → 2025.1.4Session登出修复、
VariantSelector
废弃、商品查询更新、
ProductForm
重构
2025.5.0 → 2025.7.0重大更新 — React Router 7.9.x 迁移、上下文创建、入口点更新
2025.7.0 → 2026.1.0重大更新
@react-router
7.12、
@shopify/hydrogen
2026.1.0、Storefront API 2026-01、全新购物车mutation

Upgrade Process

升级流程

1. Use the official upgrade tool first

1. 优先使用官方升级工具

bash
npx @shopify/upgrade
This CLI diffs your project against the latest Hydrogen skeleton and applies changes interactively.
bash
npx @shopify/upgrade
该CLI工具会将你的项目与最新的Hydrogen骨架项目进行对比,并以交互方式应用变更。

2. Find the right guide above

2. 从上方找到适配的升级指南

Match your current version to the appropriate guide. For multi-version jumps, apply each guide in order.
将你当前使用的版本与对应的指南匹配,如果需要跨多个版本升级,请按顺序依次执行每个指南的步骤。

3. Regenerate types after upgrading

3. 升级后重新生成类型定义

bash
npm run codegen
Never edit
.d.ts
generated files directly — always regenerate them.
bash
npm run codegen
请勿直接编辑生成的
.d.ts
文件,始终通过重新生成的方式更新。

4. Resources

4. 参考资源