@shopify/hydrogen@2023.10.0
Major and Breaking Changes
Remix v2 (#1289) by @frandiox
Hydrogen 2023-10 has upgraded to Remix v2 and is now a peer dependency.
-
Please check the Remix v2 release notes to see what needs to be changed in your app code. Common changes include:
- Renaming types prefixed with
V2_
. For example,V2_MetaFunction
is nowMetaFunction
. - Renaming other types like
LoaderArgs
andActionArgs
, which are nowLoaderFunctionArgs
andActionFunctionArgs
respectively.
If you were not already using v2 flags, follow the official Remix migration guide before upgrading to v2.
- Renaming types prefixed with
-
Update to Remix v2. Remix is now a peer dependency and its version is no longer pinned. This means that you can upgrade to newer Remix 2.x versions without upgrading Hydrogen. (#1289) by @frandiox
Other breaking changes
-
The default caching strategy has been updated. The new default caching strategy provides a
max-age
value of 1 second, and astale-while-revalidate
value of 1 day. If you would keep the old caching values, update your queries to useCacheShort
: (#1336) by @benjaminsehlconst {product} = await storefront.query( `#graphql query Product($handle: String!) { product(handle: $handle) { id title } } `, { variables: {handle: params.productHandle}, + /** + * Override the default caching strategy with the old caching values + */ + cache: storefront.CacheShort(), }, );
-
The Storefront API types included are now generated using
@graphql-codegen/typescript@4
(changelog). This results in a breaking change if you were importingScalars
directly from@shopify/hydrogen-react
or@shopify/hydrogen
: (#1108) by @frandioximport type {Scalars} from '@shopify/hydrogen/storefront-api-types'; type Props = { - id: Scalars['ID']; // This was a string + id: Scalars['ID']['input']; // Need to access 'input' or 'output' to get the string };
Patch Changes
-
Add a client to query the Customer Account API (#1430) by @blittle
-
Update Storefront API version to 2023-10 (#1431) by @wizardlyhel
-
Custom cart methods are now stable: (#1440) by @wizardlyhel
const cart = createCartHandler({ storefront, getCartId, setCartId: cartSetIdDefault(), - customMethods__unstable: { + customMethods: { addLines: async (lines, optionalParams) => { // ... }, }, });
-
Remove deprecated parameters and props (#1455 and #1435): (#1435) by @wizardlyhel
createStorefrontClient
parametersbuyerIp
andrequestGroupId
<Image>
propsloaderOptions
andwidths
-
Add query explorer plugin to GraphiQL. Start your dev server and load
http://localhost:3000/graphiql
to use GraphiQL. (#1470) by @frandiox -
Updated dependencies [
0ae7cbe2
,ad45656c
]:- @shopify/hydrogen-react@2023.10.0