Skip to content

@shopify/hydrogen@2023.10.0

Compare
Choose a tag to compare
@shopify-github-actions-access shopify-github-actions-access released this 31 Oct 17:44
· 302 commits to main since this release
300fe1b

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 now MetaFunction.
    • Renaming other types like LoaderArgs and ActionArgs, which are now LoaderFunctionArgs and ActionFunctionArgs respectively.

    If you were not already using v2 flags, follow the official Remix migration guide before upgrading to v2.

  • 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 a stale-while-revalidate value of 1 day. If you would keep the old caching values, update your queries to use CacheShort: (#1336) by @benjaminsehl

     const {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 importing Scalars directly from @shopify/hydrogen-react or @shopify/hydrogen: (#1108) by @frandiox

     import 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 parameters buyerIp and requestGroupId
    • <Image> props loaderOptions and widths
  • 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