Skip to content

@shopify/hydrogen@2024.1.0

Compare
Choose a tag to compare
@shopify-github-actions-access shopify-github-actions-access released this 25 Jan 23:39
· 218 commits to main since this release
aa78ac8

Major Changes

  • Better Hydrogen error handling (#1645) by @wizardlyhel

    • Fix storefront client throwing on partial successful errors
    • Fix subrequest profiler to better display network errors with URL information for Storefront API requests

    Breaking change

    This update changes the shape of the error objects returned by the createCartHandler method.

    Previously, mutations could return an errors array that contained a userErrors array.

    With this change, these arrays are no longer nested. The response can contain both an errors array and a userErrors array. errors contains GraphQL execution errors. userErrors contains errors caused by the cart mutation itself (such as adding a product that has zero inventory).

    storefront.isApiError is deprecated.

    Updated return types for createCartHandler methods

    • cart.get() used to return a Cart type. Now it returns CartReturn type to accommodate the errors object.
    • All other cart methods (ie. cart.addLines) used to return a CartQueryData type. Now it returns CartQueryDataReturn type to accommodate the errors object.
  • Custom rules passed to createContentSecurityPolicy now extend the default Shopify and development domains, instead of overriding them (#1593) by @michenly

  • Upgrade to Storefront API v2024-01 (#1642) by @wizardlyhel

Minor Changes

Patch Changes

  • Fix a bug that allowed undesired redirect to external domains (#1629) by @wizardlyhel

  • Fix content security policy to recognize localhost asset server as a valid source when running the dev command (#1591) by @michenly

  • Fix the <Seo /> component to render canonical URLs without trailing slashes. Thanks to @joshuafredrickson for reporting (#1622) by @blittle

  • Make default HydrogenSession type extensible. (#1590) by @michenly

    Update implementation of HydrogenSession using type:

    import {
    + type HydrogenSession,
    } from '@shopify/hydrogen';
    - class HydrogenSession {
    + class AppSession implements HydrogenSession {
        ...
    }
  • Fix error stack traces thrown by API clients if promises are not awaited (#1656) by @frandiox

  • Updated dependencies [0629bc77, dc8f90de, ca1161b2]:

    • @shopify/hydrogen-react@2024.1.0