v0.7.0
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
- feat: format CLI output with prettier by @cartogram in Shopify/hydrogen#222
- feat: CLI display if file changed by @cartogram in Shopify/hydrogen#219
- fix: default to retry: false in react-query by @jplhomer in Shopify/hydrogen#234
- Fix: Prevent error when store has no products by @ThomasAndrewMacLean in Shopify/hydrogen#232
- fix: starter template media gallery error when handling videos by @scottdixon in Shopify/hydrogen#226
- VSCode extensions > Add prettier + eslint by @rafaelstz in Shopify/hydrogen#218
- docs: add shield.io badges to primary readme by @Eastonco in Shopify/hydrogen#216
- feat: eslint rule no effects on server by @cartogram in Shopify/hydrogen#220
- Adding devcontainer by @rafaelstz in Shopify/hydrogen#164
- fix(#243): fix graphiql by running graphiql middleware before vite by @blittle in Shopify/hydrogen#248
- feat: add windows to our CI test build by @blittle in Shopify/hydrogen#212
- feat: allow custom Model3D poster by @scottdixon in Shopify/hydrogen#225
- refactor: remove Intl polyfill by @frandiox in Shopify/hydrogen#262
- Implement server redirects by @frandiox in https://github.com/Shopify/hydrogen/pull/172
- fix: ensure to call waitUntil with proper "this" if present by @maxshirshin in Shopify/hydrogen#265
- Add support for file reference metafield by @cathryngriffiths in Shopify/hydrogen#208
- fix: warn and ignore reserved properties in server state by @frandiox in Shopify/hydrogen#241
- fix: middleware import by @frandiox in Shopify/hydrogen#271
- fix: workaround for sourcemap warnings by @frandiox in Shopify/hydrogen#277
- docs: add docs for response.redirect() by @jplhomer in Shopify/hydrogen#274
- Misc CLI improvements to support the
checkcommand by @cartogram in Shopify/hydrogen#266 - docs: Model3d poster props by @scottdixon in Shopify/hydrogen#275
- fix: update variantID to variantId by @Eastonco in Shopify/hydrogen#217
- Add 404 link to footer by @mynameisadamf in Shopify/hydrogen#257
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
- @ThomasAndrewMacLean made their first contribution in Shopify/hydrogen#232
- @scottdixon made their first contribution in Shopify/hydrogen#226
- @rafaelstz made their first contribution in Shopify/hydrogen#218
- @maxshirshin made their first contribution in Shopify/hydrogen#265
Full Changelog: Shopify/hydrogen@v0.6.4...v0.7.0