From 19010ad9630c73632102ba94a989be0e08ef1fa9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 13 Feb 2025 18:54:06 +0000 Subject: [PATCH] [ci] release 2025-01 --- .changeset/afraid-onions-change.md | 6 - .changeset/cyan-paws-punch.md | 25 ---- .changeset/forty-badgers-wonder.md | 7 - .changeset/moody-chefs-change.md | 9 -- .changeset/plenty-cycles-act.md | 197 ------------------------ .changeset/purple-buses-laugh.md | 7 - .changeset/unlucky-bags-kiss.md | 36 ----- examples/express/package.json | 2 +- packages/cli/CHANGELOG.md | 8 + packages/cli/oclif.manifest.json | 2 +- packages/cli/package.json | 2 +- packages/create-hydrogen/CHANGELOG.md | 6 + packages/create-hydrogen/package.json | 2 +- packages/hydrogen-react/CHANGELOG.md | 8 + packages/hydrogen-react/package.json | 2 +- packages/hydrogen/CHANGELOG.md | 71 +++++++++ packages/hydrogen/package.json | 4 +- packages/hydrogen/src/version.ts | 2 +- packages/remix-oxygen/CHANGELOG.md | 8 + packages/remix-oxygen/package.json | 2 +- templates/skeleton/CHANGELOG.md | 206 ++++++++++++++++++++++++++ templates/skeleton/package.json | 6 +- 22 files changed, 319 insertions(+), 299 deletions(-) delete mode 100644 .changeset/afraid-onions-change.md delete mode 100644 .changeset/cyan-paws-punch.md delete mode 100644 .changeset/forty-badgers-wonder.md delete mode 100644 .changeset/moody-chefs-change.md delete mode 100644 .changeset/plenty-cycles-act.md delete mode 100644 .changeset/purple-buses-laugh.md delete mode 100644 .changeset/unlucky-bags-kiss.md diff --git a/.changeset/afraid-onions-change.md b/.changeset/afraid-onions-change.md deleted file mode 100644 index 5eab4230e0..0000000000 --- a/.changeset/afraid-onions-change.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@shopify/hydrogen-react': patch -'@shopify/hydrogen': patch ---- - -Update `getProductOptions` to handle divergent product options. diff --git a/.changeset/cyan-paws-punch.md b/.changeset/cyan-paws-punch.md deleted file mode 100644 index 14733fbf1d..0000000000 --- a/.changeset/cyan-paws-punch.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Added the ability to optionally provide `language` data to `createCustomerAccountClient`, and automatically pass it down to it from `createHydrogenContext`. -If present, the provided `language` will be used to set the `uilocales` property in the Customer Account API request. - -```ts -// Optional: provide language data to the constructor -const customerAccount = createCustomerAccountClient({ - // ... - language, -}); -``` - -Calls to `login()` will use the provided `language` without having to pass it explicitly via `uiLocales`; however, if the `login()` method is -already using its `uilocales` property, the `language` parameter coming from the context/constructor will be ignored. If nothing is explicitly passed, `login()` will default to `context.i18n.language`. - -```ts -export async function loader({request, context}: LoaderFunctionArgs) { - return context.customerAccount.login({ - uiLocales: 'FR', // will be used instead of the one coming from the context - }); -} -``` diff --git a/.changeset/forty-badgers-wonder.md b/.changeset/forty-badgers-wonder.md deleted file mode 100644 index 0f9d8cfca3..0000000000 --- a/.changeset/forty-badgers-wonder.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@shopify/hydrogen-react': patch -'skeleton': patch -'@shopify/hydrogen': patch ---- - -Upgrade eslint to version 9 and unify eslint config across all packages (with the exception of the skeleton, which still keeps its own config) diff --git a/.changeset/moody-chefs-change.md b/.changeset/moody-chefs-change.md deleted file mode 100644 index 88b65afe72..0000000000 --- a/.changeset/moody-chefs-change.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@shopify/remix-oxygen': patch -'skeleton': patch -'@shopify/hydrogen': patch -'@shopify/cli-hydrogen': patch -'@shopify/create-hydrogen': patch ---- - -Bump remix version diff --git a/.changeset/plenty-cycles-act.md b/.changeset/plenty-cycles-act.md deleted file mode 100644 index a2b8eb7248..0000000000 --- a/.changeset/plenty-cycles-act.md +++ /dev/null @@ -1,197 +0,0 @@ ---- -'skeleton': patch ---- - -Turn on Remix `v3_singleFetch` future flag - -Remix single fetch migration quick guide: https://remix.run/docs/en/main/start/future-flags#v3_singlefetch -Remix single fetch migration guide: https://remix.run/docs/en/main/guides/single-fetch - -**Note:** If you have any routes that appends (or looks for) a search param named `_data`, make sure to rename it to something else. - -1. In your `vite.config.ts`, add the single fetch future flag. - - ```diff - + declare module "@remix-run/server-runtime" { - + interface Future { - + v3_singleFetch: true; - + } - + } - - export default defineConfig({ - plugins: [ - hydrogen(), - oxygen(), - remix({ - presets: [hydrogen.preset()], - future: { - v3_fetcherPersist: true, - v3_relativeSplatPath: true, - v3_throwAbortReason: true, - v3_lazyRouteDiscovery: true, - + v3_singleFetch: true, - }, - }), - tsconfigPaths(), - ], - ``` - -2. In your `entry.server.tsx`, add `nonce` to the ``. - - ```diff - const body = await renderToReadableStream( - - - , - ``` - -3. Update the `shouldRevalidate` function in `root.tsx`. - - Defaulting to no revalidation for root loader data to improve performance. When using this feature, you risk your UI getting out of sync with your server. Use with caution. If you are uncomfortable with this optimization, update the `return false;` to `return defaultShouldRevalidate;` instead. - - For more details see: https://remix.run/docs/en/main/route/should-revalidate - - ```diff - export const shouldRevalidate: ShouldRevalidateFunction = ({ - formMethod, - currentUrl, - nextUrl, - - defaultShouldRevalidate, - }) => { - // revalidate when a mutation is performed e.g add to cart, login... - if (formMethod && formMethod !== 'GET') return true; - - // revalidate when manually revalidating via useRevalidator - if (currentUrl.toString() === nextUrl.toString()) return true; - - - return defaultShouldRevalidate; - + return false; - }; - ``` - -4. Update `cart.tsx` to add a headers export and update to `data` import usage. - - ```diff - import { - - json, - + data, - type LoaderFunctionArgs, - type ActionFunctionArgs, - type HeadersFunction - } from '@shopify/remix-oxygen'; - + export const headers: HeadersFunction = ({actionHeaders}) => actionHeaders; - - export async function action({request, context}: ActionFunctionArgs) { - ... - - return json( - + return data( - { - cart: cartResult, - errors, - warnings, - analytics: { - cartId, - }, - }, - {status, headers}, - ); - } - - export async function loader({context}: LoaderFunctionArgs) { - const {cart} = context; - - return json(await cart.get()); - + return await cart.get(); - } - ``` - -5. Deprecate `json` and `defer` import usage from `@shopify/remix-oxygen`. - - Remove `json()`/`defer()` in favor of raw objects. - - Single Fetch supports JSON objects and Promises out of the box, so you can return the raw data from your loader/action functions: - - ```diff - - import {json} from "@shopify/remix-oxygen"; - - export async function loader({}: LoaderFunctionArgs) { - let tasks = await fetchTasks(); - - return json(tasks); - + return tasks; - } - ``` - - ```diff - - import {defer} from "@shopify/remix-oxygen"; - - export async function loader({}: LoaderFunctionArgs) { - let lazyStuff = fetchLazyStuff(); - let tasks = await fetchTasks(); - - return defer({ tasks, lazyStuff }); - + return { tasks, lazyStuff }; - } - ``` - - If you were using the second parameter of json/defer to set a custom status or headers on your response, you can continue doing so via the new data API: - - ```diff - - import {json} from "@shopify/remix-oxygen"; - + import {data, type HeadersFunction} from "@shopify/remix-oxygen"; - - + /** - + * If your loader or action is returning a response with headers, - + * make sure to export a headers function that merges your headers - + * on your route. Otherwise, your headers may be lost. - + * Remix doc: https://remix.run/docs/en/main/route/headers - + **/ - + export const headers: HeadersFunction = ({loaderHeaders}) => loaderHeaders; - - export async function loader({}: LoaderFunctionArgs) { - let tasks = await fetchTasks(); - - return json(tasks, { - + return data(tasks, { - headers: { - "Cache-Control": "public, max-age=604800" - } - }); - } - ``` - -6. If you are using legacy customer account flow or multipass, there are a couple more files that requires updating: - - In `root.tsx` and `routes/account.tsx`, add a `headers` export for `loaderHeaders`. - - ```diff - + export const headers: HeadersFunction = ({loaderHeaders}) => loaderHeaders; - ``` - - In `routes/account_.register.tsx`, add a `headers` export for `actionHeaders`. - - ```diff - + export const headers: HeadersFunction = ({actionHeaders}) => actionHeaders; - ``` - -7. If you are using multipass, in `routes/account_.login.multipass.tsx` - - a. export a `headers` export - - ```diff - + export const headers: HeadersFunction = ({actionHeaders}) => actionHeaders; - ``` - - b. Update all `json` response wrapper to `remixData` - - ```diff - import { - - json, - + data as remixData, - } from '@shopify/remix-oxygen'; - - - return json( - + return remixData( - ... - ); - ``` diff --git a/.changeset/purple-buses-laugh.md b/.changeset/purple-buses-laugh.md deleted file mode 100644 index f1b9a54a92..0000000000 --- a/.changeset/purple-buses-laugh.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@shopify/remix-oxygen': patch -'@shopify/hydrogen': patch -'@shopify/cli-hydrogen': patch ---- - -Turn on Remix `v3_singleFetch` future flag diff --git a/.changeset/unlucky-bags-kiss.md b/.changeset/unlucky-bags-kiss.md deleted file mode 100644 index 3586154ce8..0000000000 --- a/.changeset/unlucky-bags-kiss.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -B2B methods and props are now stable. Warnings are in place for unstable usages and will be removed completely in the next major version. - -1. Search for anywhere using `UNSTABLE_getBuyer` and `UNSTABLE_setBuyer` is update accordingly. - - ```diff - - customerAccount.UNSTABLE_getBuyer(); - + customerAccount.getBuyer() - - - customerAccount.UNSTABLE_setBuyer({ - + customerAccount.setBuyer({ - companyLocationId, - }); - ``` - -2. Update `createHydrogenContext` to remove the `unstableB2b` option - - ```diff - const hydrogenContext = createHydrogenContext({ - env, - request, - cache, - waitUntil, - session, - i18n: {language: 'EN', country: 'US'}, - - customerAccount: { - - unstableB2b: true, - - }, - cart: { - queryFragment: CART_QUERY_FRAGMENT, - }, - }); - ``` diff --git a/examples/express/package.json b/examples/express/package.json index 550912ab4e..78b839b9dd 100644 --- a/examples/express/package.json +++ b/examples/express/package.json @@ -14,7 +14,7 @@ "@remix-run/node": "^2.15.3", "@remix-run/react": "^2.15.3", "@remix-run/server-runtime": "^2.15.3", - "@shopify/hydrogen": "2025.1.0", + "@shopify/hydrogen": "2025.1.1", "compression": "^1.7.4", "cross-env": "^7.0.3", "express": "^4.19.2", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 8384a9afcc..bde056eb44 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,13 @@ # @shopify/cli-hydrogen +## 9.0.6 + +### Patch Changes + +- Bump remix version ([#2740](https://github.com/Shopify/hydrogen/pull/2740)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Turn on Remix `v3_singleFetch` future flag ([#2708](https://github.com/Shopify/hydrogen/pull/2708)) by [@wizardlyhel](https://github.com/wizardlyhel) + ## 9.0.5 ### Patch Changes diff --git a/packages/cli/oclif.manifest.json b/packages/cli/oclif.manifest.json index e7ec8365b9..8d2edb55df 100644 --- a/packages/cli/oclif.manifest.json +++ b/packages/cli/oclif.manifest.json @@ -1748,5 +1748,5 @@ ] } }, - "version": "9.0.5" + "version": "9.0.6" } \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index 11977329bb..a79484d25c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -4,7 +4,7 @@ "access": "public", "@shopify:registry": "https://registry.npmjs.org" }, - "version": "9.0.5", + "version": "9.0.6", "license": "MIT", "type": "module", "repository": { diff --git a/packages/create-hydrogen/CHANGELOG.md b/packages/create-hydrogen/CHANGELOG.md index 3a53b8416b..93b3975763 100644 --- a/packages/create-hydrogen/CHANGELOG.md +++ b/packages/create-hydrogen/CHANGELOG.md @@ -1,5 +1,11 @@ # @shopify/create-hydrogen +## 5.0.16 + +### Patch Changes + +- Bump remix version ([#2740](https://github.com/Shopify/hydrogen/pull/2740)) by [@wizardlyhel](https://github.com/wizardlyhel) + ## 5.0.15 ### Patch Changes diff --git a/packages/create-hydrogen/package.json b/packages/create-hydrogen/package.json index d73de94755..4ebe5dc467 100644 --- a/packages/create-hydrogen/package.json +++ b/packages/create-hydrogen/package.json @@ -5,7 +5,7 @@ "@shopify:registry": "https://registry.npmjs.org" }, "license": "MIT", - "version": "5.0.15", + "version": "5.0.16", "type": "module", "repository": { "type": "git", diff --git a/packages/hydrogen-react/CHANGELOG.md b/packages/hydrogen-react/CHANGELOG.md index 98faddaa53..1136b51767 100644 --- a/packages/hydrogen-react/CHANGELOG.md +++ b/packages/hydrogen-react/CHANGELOG.md @@ -1,5 +1,13 @@ # @shopify/hydrogen-react +## 2025.1.1 + +### Patch Changes + +- Update `getProductOptions` to handle divergent product options. ([#2747](https://github.com/Shopify/hydrogen/pull/2747)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Upgrade eslint to version 9 and unify eslint config across all packages (with the exception of the skeleton, which still keeps its own config) ([#2716](https://github.com/Shopify/hydrogen/pull/2716)) by [@liady](https://github.com/liady) + ## 2025.1.0 ### Patch Changes diff --git a/packages/hydrogen-react/package.json b/packages/hydrogen-react/package.json index a5fb840d36..2726815584 100644 --- a/packages/hydrogen-react/package.json +++ b/packages/hydrogen-react/package.json @@ -1,6 +1,6 @@ { "name": "@shopify/hydrogen-react", - "version": "2025.1.0", + "version": "2025.1.1", "description": "React components, hooks, and utilities for creating custom Shopify storefronts", "homepage": "https://github.com/Shopify/hydrogen/tree/main/packages/hydrogen-react", "license": "MIT", diff --git a/packages/hydrogen/CHANGELOG.md b/packages/hydrogen/CHANGELOG.md index d451edb7f7..daeb84e845 100644 --- a/packages/hydrogen/CHANGELOG.md +++ b/packages/hydrogen/CHANGELOG.md @@ -1,5 +1,76 @@ # @shopify/hydrogen +## 2025.1.1 + +### Patch Changes + +- Update `getProductOptions` to handle divergent product options. ([#2747](https://github.com/Shopify/hydrogen/pull/2747)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Added the ability to optionally provide `language` data to `createCustomerAccountClient`, and automatically pass it down to it from `createHydrogenContext`. ([#2746](https://github.com/Shopify/hydrogen/pull/2746)) by [@ruggishop](https://github.com/ruggishop) + + If present, the provided `language` will be used to set the `uilocales` property in the Customer Account API request. + + ```ts + // Optional: provide language data to the constructor + const customerAccount = createCustomerAccountClient({ + // ... + language, + }); + ``` + + Calls to `login()` will use the provided `language` without having to pass it explicitly via `uiLocales`; however, if the `login()` method is + already using its `uilocales` property, the `language` parameter coming from the context/constructor will be ignored. If nothing is explicitly passed, `login()` will default to `context.i18n.language`. + + ```ts + export async function loader({request, context}: LoaderFunctionArgs) { + return context.customerAccount.login({ + uiLocales: 'FR', // will be used instead of the one coming from the context + }); + } + ``` + +- Upgrade eslint to version 9 and unify eslint config across all packages (with the exception of the skeleton, which still keeps its own config) ([#2716](https://github.com/Shopify/hydrogen/pull/2716)) by [@liady](https://github.com/liady) + +- Bump remix version ([#2740](https://github.com/Shopify/hydrogen/pull/2740)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Turn on Remix `v3_singleFetch` future flag ([#2708](https://github.com/Shopify/hydrogen/pull/2708)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- B2B methods and props are now stable. Warnings are in place for unstable usages and will be removed completely in the next major version. ([#2736](https://github.com/Shopify/hydrogen/pull/2736)) by [@dustinfirman](https://github.com/dustinfirman) + + 1. Search for anywhere using `UNSTABLE_getBuyer` and `UNSTABLE_setBuyer` is update accordingly. + + ```diff + - customerAccount.UNSTABLE_getBuyer(); + + customerAccount.getBuyer() + + - customerAccount.UNSTABLE_setBuyer({ + + customerAccount.setBuyer({ + companyLocationId, + }); + ``` + + 2. Update `createHydrogenContext` to remove the `unstableB2b` option + + ```diff + const hydrogenContext = createHydrogenContext({ + env, + request, + cache, + waitUntil, + session, + i18n: {language: 'EN', country: 'US'}, + - customerAccount: { + - unstableB2b: true, + - }, + cart: { + queryFragment: CART_QUERY_FRAGMENT, + }, + }); + ``` + +- Updated dependencies [[`3af2e453`](https://github.com/Shopify/hydrogen/commit/3af2e4534eafe1467f70a35885a2fa2ef7724fa8), [`cd65685c`](https://github.com/Shopify/hydrogen/commit/cd65685c1036233faaead0330f25183900b102a7)]: + - @shopify/hydrogen-react@2025.1.1 + ## 2025.1.0 ### Patch Changes diff --git a/packages/hydrogen/package.json b/packages/hydrogen/package.json index 9a9df2abaf..9d077fad46 100644 --- a/packages/hydrogen/package.json +++ b/packages/hydrogen/package.json @@ -5,7 +5,7 @@ "@shopify:registry": "https://registry.npmjs.org" }, "type": "module", - "version": "2025.1.0", + "version": "2025.1.1", "license": "MIT", "main": "dist/index.cjs", "module": "dist/production/index.js", @@ -68,7 +68,7 @@ "dist" ], "dependencies": { - "@shopify/hydrogen-react": "2025.1.0", + "@shopify/hydrogen-react": "2025.1.1", "content-security-policy-builder": "^2.2.0", "isbot": "^5.1.21", "source-map-support": "^0.5.21", diff --git a/packages/hydrogen/src/version.ts b/packages/hydrogen/src/version.ts index 98bae528d6..0fab1d9e9a 100644 --- a/packages/hydrogen/src/version.ts +++ b/packages/hydrogen/src/version.ts @@ -1 +1 @@ -export const LIB_VERSION = '2025.1.0'; +export const LIB_VERSION = '2025.1.1'; diff --git a/packages/remix-oxygen/CHANGELOG.md b/packages/remix-oxygen/CHANGELOG.md index 3edcc23dd6..c44ea6352e 100644 --- a/packages/remix-oxygen/CHANGELOG.md +++ b/packages/remix-oxygen/CHANGELOG.md @@ -1,5 +1,13 @@ # @shopify/remix-oxygen +## 2.0.11 + +### Patch Changes + +- Bump remix version ([#2740](https://github.com/Shopify/hydrogen/pull/2740)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Turn on Remix `v3_singleFetch` future flag ([#2708](https://github.com/Shopify/hydrogen/pull/2708)) by [@wizardlyhel](https://github.com/wizardlyhel) + ## 2.0.10 ### Patch Changes diff --git a/packages/remix-oxygen/package.json b/packages/remix-oxygen/package.json index 12c5beec92..3dfe04df8e 100644 --- a/packages/remix-oxygen/package.json +++ b/packages/remix-oxygen/package.json @@ -5,7 +5,7 @@ "@shopify:registry": "https://registry.npmjs.org" }, "type": "module", - "version": "2.0.10", + "version": "2.0.11", "license": "MIT", "main": "dist/index.cjs", "module": "dist/production/index.js", diff --git a/templates/skeleton/CHANGELOG.md b/templates/skeleton/CHANGELOG.md index 544717746d..e884b898d3 100644 --- a/templates/skeleton/CHANGELOG.md +++ b/templates/skeleton/CHANGELOG.md @@ -1,5 +1,211 @@ # skeleton +## 2025.1.1 + +### Patch Changes + +- Upgrade eslint to version 9 and unify eslint config across all packages (with the exception of the skeleton, which still keeps its own config) ([#2716](https://github.com/Shopify/hydrogen/pull/2716)) by [@liady](https://github.com/liady) + +- Bump remix version ([#2740](https://github.com/Shopify/hydrogen/pull/2740)) by [@wizardlyhel](https://github.com/wizardlyhel) + +- Turn on Remix `v3_singleFetch` future flag ([#2708](https://github.com/Shopify/hydrogen/pull/2708)) by [@wizardlyhel](https://github.com/wizardlyhel) + + Remix single fetch migration quick guide: https://remix.run/docs/en/main/start/future-flags#v3_singlefetch + Remix single fetch migration guide: https://remix.run/docs/en/main/guides/single-fetch + + **Note:** If you have any routes that appends (or looks for) a search param named `_data`, make sure to rename it to something else. + + 1. In your `vite.config.ts`, add the single fetch future flag. + + ```diff + + declare module "@remix-run/server-runtime" { + + interface Future { + + v3_singleFetch: true; + + } + + } + + export default defineConfig({ + plugins: [ + hydrogen(), + oxygen(), + remix({ + presets: [hydrogen.preset()], + future: { + v3_fetcherPersist: true, + v3_relativeSplatPath: true, + v3_throwAbortReason: true, + v3_lazyRouteDiscovery: true, + + v3_singleFetch: true, + }, + }), + tsconfigPaths(), + ], + ``` + + 2. In your `entry.server.tsx`, add `nonce` to the ``. + + ```diff + const body = await renderToReadableStream( + + + , + ``` + + 3. Update the `shouldRevalidate` function in `root.tsx`. + + Defaulting to no revalidation for root loader data to improve performance. When using this feature, you risk your UI getting out of sync with your server. Use with caution. If you are uncomfortable with this optimization, update the `return false;` to `return defaultShouldRevalidate;` instead. + + For more details see: https://remix.run/docs/en/main/route/should-revalidate + + ```diff + export const shouldRevalidate: ShouldRevalidateFunction = ({ + formMethod, + currentUrl, + nextUrl, + - defaultShouldRevalidate, + }) => { + // revalidate when a mutation is performed e.g add to cart, login... + if (formMethod && formMethod !== 'GET') return true; + + // revalidate when manually revalidating via useRevalidator + if (currentUrl.toString() === nextUrl.toString()) return true; + + - return defaultShouldRevalidate; + + return false; + }; + ``` + + 4. Update `cart.tsx` to add a headers export and update to `data` import usage. + + ```diff + import { + - json, + + data, + type LoaderFunctionArgs, + type ActionFunctionArgs, + type HeadersFunction + } from '@shopify/remix-oxygen'; + + export const headers: HeadersFunction = ({actionHeaders}) => actionHeaders; + + export async function action({request, context}: ActionFunctionArgs) { + ... + - return json( + + return data( + { + cart: cartResult, + errors, + warnings, + analytics: { + cartId, + }, + }, + {status, headers}, + ); + } + + export async function loader({context}: LoaderFunctionArgs) { + const {cart} = context; + - return json(await cart.get()); + + return await cart.get(); + } + ``` + + 5. Deprecate `json` and `defer` import usage from `@shopify/remix-oxygen`. + + Remove `json()`/`defer()` in favor of raw objects. + + Single Fetch supports JSON objects and Promises out of the box, so you can return the raw data from your loader/action functions: + + ```diff + - import {json} from "@shopify/remix-oxygen"; + + export async function loader({}: LoaderFunctionArgs) { + let tasks = await fetchTasks(); + - return json(tasks); + + return tasks; + } + ``` + + ```diff + - import {defer} from "@shopify/remix-oxygen"; + + export async function loader({}: LoaderFunctionArgs) { + let lazyStuff = fetchLazyStuff(); + let tasks = await fetchTasks(); + - return defer({ tasks, lazyStuff }); + + return { tasks, lazyStuff }; + } + ``` + + If you were using the second parameter of json/defer to set a custom status or headers on your response, you can continue doing so via the new data API: + + ```diff + - import {json} from "@shopify/remix-oxygen"; + + import {data, type HeadersFunction} from "@shopify/remix-oxygen"; + + + /** + + * If your loader or action is returning a response with headers, + + * make sure to export a headers function that merges your headers + + * on your route. Otherwise, your headers may be lost. + + * Remix doc: https://remix.run/docs/en/main/route/headers + + **/ + + export const headers: HeadersFunction = ({loaderHeaders}) => loaderHeaders; + + export async function loader({}: LoaderFunctionArgs) { + let tasks = await fetchTasks(); + - return json(tasks, { + + return data(tasks, { + headers: { + "Cache-Control": "public, max-age=604800" + } + }); + } + ``` + + 6. If you are using legacy customer account flow or multipass, there are a couple more files that requires updating: + + In `root.tsx` and `routes/account.tsx`, add a `headers` export for `loaderHeaders`. + + ```diff + + export const headers: HeadersFunction = ({loaderHeaders}) => loaderHeaders; + ``` + + In `routes/account_.register.tsx`, add a `headers` export for `actionHeaders`. + + ```diff + + export const headers: HeadersFunction = ({actionHeaders}) => actionHeaders; + ``` + + 7. If you are using multipass, in `routes/account_.login.multipass.tsx` + + a. export a `headers` export + + ```diff + + export const headers: HeadersFunction = ({actionHeaders}) => actionHeaders; + ``` + + b. Update all `json` response wrapper to `remixData` + + ```diff + import { + - json, + + data as remixData, + } from '@shopify/remix-oxygen'; + + - return json( + + return remixData( + ... + ); + ``` + +- Updated dependencies [[`3af2e453`](https://github.com/Shopify/hydrogen/commit/3af2e4534eafe1467f70a35885a2fa2ef7724fa8), [`6bff6b62`](https://github.com/Shopify/hydrogen/commit/6bff6b6260af21b8025426c7031ab862dbecbc34), [`cd65685c`](https://github.com/Shopify/hydrogen/commit/cd65685c1036233faaead0330f25183900b102a7), [`8c717570`](https://github.com/Shopify/hydrogen/commit/8c7175701d9f4dd05d271ea46b6ab40d6e3210cb), [`4e81bd1b`](https://github.com/Shopify/hydrogen/commit/4e81bd1b0e99b5c760679b565d2f95c4fc15b934), [`3ea25820`](https://github.com/Shopify/hydrogen/commit/3ea25820b0b0094d982e481782e413165435cf00)]: + - @shopify/hydrogen@2025.1.1 + - @shopify/remix-oxygen@2.0.11 + ## 2025.1.0 ### Patch Changes diff --git a/templates/skeleton/package.json b/templates/skeleton/package.json index 773a68bc17..0798968dc9 100644 --- a/templates/skeleton/package.json +++ b/templates/skeleton/package.json @@ -2,7 +2,7 @@ "name": "skeleton", "private": true, "sideEffects": false, - "version": "2025.1.0", + "version": "2025.1.1", "type": "module", "scripts": { "build": "shopify hydrogen build --codegen", @@ -16,8 +16,8 @@ "dependencies": { "@remix-run/react": "^2.15.3", "@remix-run/server-runtime": "^2.15.3", - "@shopify/hydrogen": "2025.1.0", - "@shopify/remix-oxygen": "^2.0.10", + "@shopify/hydrogen": "2025.1.1", + "@shopify/remix-oxygen": "^2.0.11", "graphql": "^16.6.0", "graphql-tag": "^2.12.6", "isbot": "^5.1.21",