@shopify/hydrogen@2024.1.0
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 auserErrors
array.With this change, these arrays are no longer nested. The response can contain both an
errors
array and auserErrors
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
methodscart.get()
used to return aCart
type. Now it returnsCartReturn
type to accommodate theerrors
object.- All other
cart
methods (ie.cart.addLines
) used to return aCartQueryData
type. Now it returnsCartQueryDataReturn
type to accommodate theerrors
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
-
Add Subrequest Profiler developer tool to enable better observability of server-side network requests and caching behaviors (#1511) by @wizardlyhel
-
Introduce the new
createCustomerAccountClient
for interacting with the Customer Account API (#1606) by @michenly
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 thedev
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 @michenlyUpdate 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