Skip to content

v0.7.0

Choose a tag to compare

@jplhomer jplhomer released this 22 Nov 14:24
· 1754 commits to main since this release

Hydrogen v0.7.0 includes a number of bug fixes, a new response.redirect() API, and other various improvements.

Important: Read the upgrade guide below for migrating your existing Hydrogen apps to v0.7.0.

What's Changed

New response.redirect() API

You can perform redirects on initial SSR page loads by calling response.redirect(url: string, code?: number).

Read the docs about response.redirect

Note: This will only work with initial SSR page responses. Subsequent SPA-style navigations are not yet supported with redirects.

Upgrade guide

If you have an existing Hydrogen app:

First, yarn add @shopify/hydrogen or NPM equivalent to get the latest version

Next, update your server.js file to use the named export of Hydrogen Middleware:

-const hydrogenMiddleware = require('@shopify/hydrogen/middleware').default;
+const {hydrogenMiddleware} = require('@shopify/hydrogen/middleware');

In your pages/products/[handle].server.jsx and any other place where you're using ProductProviderFragment, add the new required variable $includeReferenceMetafieldDetails:

const QUERY = gql`
  query product(
    $country: CountryCode
    $handle: String!
+   $includeReferenceMetafieldDetails: Boolean = true
    # ...

Finally, update any locations where you're using <AddToCartButton> or <SelectedVariantAddToCartButton> to use variantId instead of variantID:

-<AddToCartButton variantID={selectedVariant.id} />
+<AddToCartButton variantId={selectedVariant.id} />

New Contributors

Full Changelog: Shopify/hydrogen@v0.6.4...v0.7.0