From 964f0ca3620b78e96061c7188d2916a4a6bd0c40 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 26 Apr 2022 13:30:40 -0400 Subject: [PATCH] [ci] release v1.x-2022-07 (#1106) Co-authored-by: github-actions[bot] --- .changeset/big-crews-impress.md | 54 ------------ .changeset/eleven-buses-speak.md | 5 -- .changeset/eleven-oranges-dance.md | 5 -- .changeset/serious-mayflies-sleep.md | 5 -- .changeset/smart-bulldogs-bathe.md | 24 ------ .changeset/tasty-experts-flash.md | 5 -- .changeset/tough-lies-change.md | 5 -- .changeset/two-socks-pretend.md | 5 -- .changeset/unlucky-crabs-fry.md | 5 -- .../template-hydrogen-default/package.json | 2 +- packages/create-hydrogen-app/CHANGELOG.md | 82 ++++++++++++++++++ packages/create-hydrogen-app/package.json | 2 +- packages/hydrogen/CHANGELOG.md | 84 +++++++++++++++++++ packages/hydrogen/package.json | 2 +- packages/hydrogen/src/version.ts | 2 +- .../playground/server-components/package.json | 2 +- 16 files changed, 171 insertions(+), 118 deletions(-) delete mode 100644 .changeset/big-crews-impress.md delete mode 100644 .changeset/eleven-buses-speak.md delete mode 100644 .changeset/eleven-oranges-dance.md delete mode 100644 .changeset/serious-mayflies-sleep.md delete mode 100644 .changeset/smart-bulldogs-bathe.md delete mode 100644 .changeset/tasty-experts-flash.md delete mode 100644 .changeset/tough-lies-change.md delete mode 100644 .changeset/two-socks-pretend.md delete mode 100644 .changeset/unlucky-crabs-fry.md diff --git a/.changeset/big-crews-impress.md b/.changeset/big-crews-impress.md deleted file mode 100644 index 7567d85ff7..0000000000 --- a/.changeset/big-crews-impress.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -'@shopify/hydrogen': minor -'create-hydrogen-app': minor ---- - -Hydrogen now has a built in session and cookie implementation. Read more about [how sessions work in Hydrogen](https://shopify.dev/custom-storefronts/hydrogen/framework/sessions). The starter template also includes a cookie session storage implementation. To use the new session implementation within an existing Hydrogen app: - -```diff -import renderHydrogen from '@shopify/hydrogen/entry-server'; -import { - Router, - Route, - FileRoutes, - ShopifyProvider, -+ CookieSessionStorage, -} from '@shopify/hydrogen'; -import {Suspense} from 'react'; -import shopifyConfig from '../shopify.config'; -import DefaultSeo from './components/DefaultSeo.server'; -import NotFound from './components/NotFound.server'; -import LoadingFallback from './components/LoadingFallback'; -import CartProvider from './components/CartProvider.client'; - -function App({routes}) { - return ( - }> - - - - - - } /> - - - - - ); -} - -const routes = import.meta.globEager('./routes/**/*.server.[jt](s|sx)'); - -export default renderHydrogen(App, { - routes, - shopifyConfig, -+ session: CookieSessionStorage('__session', { -+ path: '/', -+ httpOnly: true, -+ secure: process.env.NODE_ENV === 'production', -+ sameSite: 'strict', -+ maxAge: 60 * 60 * 24 * 30, -+ }), -}); - -``` diff --git a/.changeset/eleven-buses-speak.md b/.changeset/eleven-buses-speak.md deleted file mode 100644 index 9812852fef..0000000000 --- a/.changeset/eleven-buses-speak.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Fix hydration issue where strings with $$ would get converted to a single $ diff --git a/.changeset/eleven-oranges-dance.md b/.changeset/eleven-oranges-dance.md deleted file mode 100644 index 6d60b61b77..0000000000 --- a/.changeset/eleven-oranges-dance.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'create-hydrogen-app': minor ---- - -Upgrade @shopify/cli-hydrogen to v2.0.0 diff --git a/.changeset/serious-mayflies-sleep.md b/.changeset/serious-mayflies-sleep.md deleted file mode 100644 index b9a22a7616..0000000000 --- a/.changeset/serious-mayflies-sleep.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'create-hydrogen-app': patch ---- - -Changing the casing on the fetchpriority attribute to all lowercase on Gallery images to prevent a React warning. diff --git a/.changeset/smart-bulldogs-bathe.md b/.changeset/smart-bulldogs-bathe.md deleted file mode 100644 index fbb615a8b8..0000000000 --- a/.changeset/smart-bulldogs-bathe.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -'@shopify/hydrogen': minor -'create-hydrogen-app': minor ---- - -## Change from serverState to serverProps - -**Breaking changes:** - -1. `useServerState()` is gone. Use `useServerProps()` instead -2. `useServerProps()` is reset on each page navigation. Previously `useServerState()` was not. -3. `useServerProps()` does not contain `pathname` and `search`. Use the [useNavigate](https://shopify.dev/api/hydrogen/hooks/framework/usenavigate) hook to programmatically navigate instead. - -**Explanation:** - -The current behavior of server state is to **persist indefinitely** (until a hard page reload). This works great for things like the CountrySelector, where the updated state is meant to persist across navigations. This breaks down for many other use cases. Consider a collection paginator: if you paginate through to the second page of a collection using server state, visit a product page, and then go to a different collection page, the new collection page will use that same pagination variable in server state. This will result in a wonky or errored experience. - -Additionally, we have found that the term for `serverState` is confusing. The hook is used within client components, yet the state is passed as a prop to server components. - -As a result, `serverState` is now gone. Instead communicating between client and server components is through `serverProps`. If a client component wants to re-render server content, it just calls `setServerProps('some', 'data')`. Those props will be serialized to the server, and the server component will re-render. Additionally, the server props are reset on page navigation. So that they will not bleed between pages (fixes #331). - -If you previously relied on `serverState` for global state in your app, you shouldn't use `serverProps` anymore. Instead we'll introduce a new session based mechanism for global state (in the meantime you could manually manage a cookie). - -Lastly, `serverProps` no longer include the `pathname` and `search` parameters. Programmatically navigate in hydrogen instead with the [useNavigate](https://shopify.dev/api/hydrogen/hooks/framework/usenavigate) hook. diff --git a/.changeset/tasty-experts-flash.md b/.changeset/tasty-experts-flash.md deleted file mode 100644 index e922316f9f..0000000000 --- a/.changeset/tasty-experts-flash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'create-hydrogen-app': patch ---- - -Fixed a bug where the price on the product details was not updating when the variant changed. diff --git a/.changeset/tough-lies-change.md b/.changeset/tough-lies-change.md deleted file mode 100644 index be13d13f0a..0000000000 --- a/.changeset/tough-lies-change.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Regenerate the graphql.schema.json which should fix the sudden end-of-line termination, and makes the schema valid again. diff --git a/.changeset/two-socks-pretend.md b/.changeset/two-socks-pretend.md deleted file mode 100644 index c37485540e..0000000000 --- a/.changeset/two-socks-pretend.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Fix Hydrogen to not hard fail when client analytics doesn't load. Analytics might fail to load due to client-side adblockers. diff --git a/.changeset/unlucky-crabs-fry.md b/.changeset/unlucky-crabs-fry.md deleted file mode 100644 index a99c662f0e..0000000000 --- a/.changeset/unlucky-crabs-fry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -Obfuscate chunk filename on production build diff --git a/examples/template-hydrogen-default/package.json b/examples/template-hydrogen-default/package.json index 17423120fc..a94c1c3d0c 100644 --- a/examples/template-hydrogen-default/package.json +++ b/examples/template-hydrogen-default/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@headlessui/react": "^1.5.0", - "@shopify/hydrogen": "^0.16.1", + "@shopify/hydrogen": "^0.17.0", "body-parser": "^1.19.1", "compression": "^1.7.4", "graphql-tag": "^2.12.4", diff --git a/packages/create-hydrogen-app/CHANGELOG.md b/packages/create-hydrogen-app/CHANGELOG.md index eb4dcb8d5b..e9541c7bf3 100644 --- a/packages/create-hydrogen-app/CHANGELOG.md +++ b/packages/create-hydrogen-app/CHANGELOG.md @@ -1,5 +1,87 @@ # Changelog +## 0.17.0 + +### Minor Changes + +- [#1044](https://github.com/Shopify/hydrogen/pull/1044) [`c8f5934d`](https://github.com/Shopify/hydrogen/commit/c8f5934d85db63162a13256cfcf21098b390887b) Thanks [@blittle](https://github.com/blittle)! - Hydrogen now has a built in session and cookie implementation. Read more about [how sessions work in Hydrogen](https://shopify.dev/custom-storefronts/hydrogen/framework/sessions). The starter template also includes a cookie session storage implementation. To use the new session implementation within an existing Hydrogen app: + + ```diff + import renderHydrogen from '@shopify/hydrogen/entry-server'; + import { + Router, + Route, + FileRoutes, + ShopifyProvider, + + CookieSessionStorage, + } from '@shopify/hydrogen'; + import {Suspense} from 'react'; + import shopifyConfig from '../shopify.config'; + import DefaultSeo from './components/DefaultSeo.server'; + import NotFound from './components/NotFound.server'; + import LoadingFallback from './components/LoadingFallback'; + import CartProvider from './components/CartProvider.client'; + + function App({routes}) { + return ( + }> + + + + + + } /> + + + + + ); + } + + const routes = import.meta.globEager('./routes/**/*.server.[jt](s|sx)'); + + export default renderHydrogen(App, { + routes, + shopifyConfig, + + session: CookieSessionStorage('__session', { + + path: '/', + + httpOnly: true, + + secure: process.env.NODE_ENV === 'production', + + sameSite: 'strict', + + maxAge: 60 * 60 * 24 * 30, + + }), + }); + + ``` + +* [#1134](https://github.com/Shopify/hydrogen/pull/1134) [`7138bb1d`](https://github.com/Shopify/hydrogen/commit/7138bb1dae884c9e057d1da2ba1f51cd05fff45a) Thanks [@michenly](https://github.com/michenly)! - Upgrade @shopify/cli-hydrogen to v2.0.0 + +- [#881](https://github.com/Shopify/hydrogen/pull/881) [`a31babfb`](https://github.com/Shopify/hydrogen/commit/a31babfb9bf73b732a18487582cec129acbb8b5e) Thanks [@jplhomer](https://github.com/jplhomer)! - ## Change from serverState to serverProps + + **Breaking changes:** + + 1. `useServerState()` is gone. Use `useServerProps()` instead + 2. `useServerProps()` is reset on each page navigation. Previously `useServerState()` was not. + 3. `useServerProps()` does not contain `pathname` and `search`. Use the [useNavigate](https://shopify.dev/api/hydrogen/hooks/framework/usenavigate) hook to programmatically navigate instead. + + **Explanation:** + + The current behavior of server state is to **persist indefinitely** (until a hard page reload). This works great for things like the CountrySelector, where the updated state is meant to persist across navigations. This breaks down for many other use cases. Consider a collection paginator: if you paginate through to the second page of a collection using server state, visit a product page, and then go to a different collection page, the new collection page will use that same pagination variable in server state. This will result in a wonky or errored experience. + + Additionally, we have found that the term for `serverState` is confusing. The hook is used within client components, yet the state is passed as a prop to server components. + + As a result, `serverState` is now gone. Instead communicating between client and server components is through `serverProps`. If a client component wants to re-render server content, it just calls `setServerProps('some', 'data')`. Those props will be serialized to the server, and the server component will re-render. Additionally, the server props are reset on page navigation. So that they will not bleed between pages (fixes #331). + + If you previously relied on `serverState` for global state in your app, you shouldn't use `serverProps` anymore. Instead we'll introduce a new session based mechanism for global state (in the meantime you could manually manage a cookie). + + Lastly, `serverProps` no longer include the `pathname` and `search` parameters. Programmatically navigate in hydrogen instead with the [useNavigate](https://shopify.dev/api/hydrogen/hooks/framework/usenavigate) hook. + +### Patch Changes + +- [#1124](https://github.com/Shopify/hydrogen/pull/1124) [`737237d2`](https://github.com/Shopify/hydrogen/commit/737237d2229a711b87092c65cbcec8305c1a7460) Thanks [@cartogram](https://github.com/cartogram)! - Changing the casing on the fetchpriority attribute to all lowercase on Gallery images to prevent a React warning. + +* [#1125](https://github.com/Shopify/hydrogen/pull/1125) [`552d627b`](https://github.com/Shopify/hydrogen/commit/552d627b5a621c65853d3b6d3825bfe47f7ccff0) Thanks [@cartogram](https://github.com/cartogram)! - Fixed a bug where the price on the product details was not updating when the variant changed. + ## 0.16.1 ## 0.16.0 diff --git a/packages/create-hydrogen-app/package.json b/packages/create-hydrogen-app/package.json index 7967e415eb..f52df62c21 100644 --- a/packages/create-hydrogen-app/package.json +++ b/packages/create-hydrogen-app/package.json @@ -4,7 +4,7 @@ "access": "public", "@shopify:registry": "https://registry.npmjs.org" }, - "version": "0.16.1", + "version": "0.17.0", "main": "index.js", "license": "MIT", "bin": { diff --git a/packages/hydrogen/CHANGELOG.md b/packages/hydrogen/CHANGELOG.md index bdd7928191..3cd9a8f61f 100644 --- a/packages/hydrogen/CHANGELOG.md +++ b/packages/hydrogen/CHANGELOG.md @@ -1,5 +1,89 @@ # Changelog +## 0.17.0 + +### Minor Changes + +- [#1044](https://github.com/Shopify/hydrogen/pull/1044) [`c8f5934d`](https://github.com/Shopify/hydrogen/commit/c8f5934d85db63162a13256cfcf21098b390887b) Thanks [@blittle](https://github.com/blittle)! - Hydrogen now has a built in session and cookie implementation. Read more about [how sessions work in Hydrogen](https://shopify.dev/custom-storefronts/hydrogen/framework/sessions). The starter template also includes a cookie session storage implementation. To use the new session implementation within an existing Hydrogen app: + + ```diff + import renderHydrogen from '@shopify/hydrogen/entry-server'; + import { + Router, + Route, + FileRoutes, + ShopifyProvider, + + CookieSessionStorage, + } from '@shopify/hydrogen'; + import {Suspense} from 'react'; + import shopifyConfig from '../shopify.config'; + import DefaultSeo from './components/DefaultSeo.server'; + import NotFound from './components/NotFound.server'; + import LoadingFallback from './components/LoadingFallback'; + import CartProvider from './components/CartProvider.client'; + + function App({routes}) { + return ( + }> + + + + + + } /> + + + + + ); + } + + const routes = import.meta.globEager('./routes/**/*.server.[jt](s|sx)'); + + export default renderHydrogen(App, { + routes, + shopifyConfig, + + session: CookieSessionStorage('__session', { + + path: '/', + + httpOnly: true, + + secure: process.env.NODE_ENV === 'production', + + sameSite: 'strict', + + maxAge: 60 * 60 * 24 * 30, + + }), + }); + + ``` + +* [#881](https://github.com/Shopify/hydrogen/pull/881) [`a31babfb`](https://github.com/Shopify/hydrogen/commit/a31babfb9bf73b732a18487582cec129acbb8b5e) Thanks [@jplhomer](https://github.com/jplhomer)! - ## Change from serverState to serverProps + + **Breaking changes:** + + 1. `useServerState()` is gone. Use `useServerProps()` instead + 2. `useServerProps()` is reset on each page navigation. Previously `useServerState()` was not. + 3. `useServerProps()` does not contain `pathname` and `search`. Use the [useNavigate](https://shopify.dev/api/hydrogen/hooks/framework/usenavigate) hook to programmatically navigate instead. + + **Explanation:** + + The current behavior of server state is to **persist indefinitely** (until a hard page reload). This works great for things like the CountrySelector, where the updated state is meant to persist across navigations. This breaks down for many other use cases. Consider a collection paginator: if you paginate through to the second page of a collection using server state, visit a product page, and then go to a different collection page, the new collection page will use that same pagination variable in server state. This will result in a wonky or errored experience. + + Additionally, we have found that the term for `serverState` is confusing. The hook is used within client components, yet the state is passed as a prop to server components. + + As a result, `serverState` is now gone. Instead communicating between client and server components is through `serverProps`. If a client component wants to re-render server content, it just calls `setServerProps('some', 'data')`. Those props will be serialized to the server, and the server component will re-render. Additionally, the server props are reset on page navigation. So that they will not bleed between pages (fixes #331). + + If you previously relied on `serverState` for global state in your app, you shouldn't use `serverProps` anymore. Instead we'll introduce a new session based mechanism for global state (in the meantime you could manually manage a cookie). + + Lastly, `serverProps` no longer include the `pathname` and `search` parameters. Programmatically navigate in hydrogen instead with the [useNavigate](https://shopify.dev/api/hydrogen/hooks/framework/usenavigate) hook. + +- [#1098](https://github.com/Shopify/hydrogen/pull/1098) [`f3dafec4`](https://github.com/Shopify/hydrogen/commit/f3dafec4b3113c85e33a15ee70b3f91c741e74f9) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Obfuscate chunk filename on production build + +### Patch Changes + +- [#1131](https://github.com/Shopify/hydrogen/pull/1131) [`8199023b`](https://github.com/Shopify/hydrogen/commit/8199023b88924db156e2a687dd6dfce2665ab638) Thanks [@blittle](https://github.com/blittle)! - Fix hydration issue where strings with $ would get converted to a single $ + +* [#1105](https://github.com/Shopify/hydrogen/pull/1105) [`57ececf8`](https://github.com/Shopify/hydrogen/commit/57ececf82ee0c264abc256df8b02555772cc2419) Thanks [@frehner](https://github.com/frehner)! - Regenerate the graphql.schema.json which should fix the sudden end-of-line termination, and makes the schema valid again. + +- [#1099](https://github.com/Shopify/hydrogen/pull/1099) [`6b50d371`](https://github.com/Shopify/hydrogen/commit/6b50d37158aab1a4a82626e09865d27e14adfbfb) Thanks [@blittle](https://github.com/blittle)! - Fix Hydrogen to not hard fail when client analytics doesn't load. Analytics might fail to load due to client-side adblockers. + ## 0.16.1 ### Patch Changes diff --git a/packages/hydrogen/package.json b/packages/hydrogen/package.json index dba86ad48e..306bb138ed 100644 --- a/packages/hydrogen/package.json +++ b/packages/hydrogen/package.json @@ -7,7 +7,7 @@ "engines": { "node": ">=14" }, - "version": "0.16.1", + "version": "0.17.0", "description": "Modern custom Shopify storefronts", "license": "MIT", "main": "dist/esnext/index.js", diff --git a/packages/hydrogen/src/version.ts b/packages/hydrogen/src/version.ts index 73a829ab61..642df85d22 100644 --- a/packages/hydrogen/src/version.ts +++ b/packages/hydrogen/src/version.ts @@ -1 +1 @@ -export const LIB_VERSION = '0.16.1'; +export const LIB_VERSION = '0.17.0'; diff --git a/packages/playground/server-components/package.json b/packages/playground/server-components/package.json index 8be4870ad8..b0626d3bcf 100644 --- a/packages/playground/server-components/package.json +++ b/packages/playground/server-components/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@cloudflare/kv-asset-handler": "*", - "@shopify/hydrogen": "^0.16.1", + "@shopify/hydrogen": "^0.17.0", "miniflare": "^1.3.3", "react": "0.0.0-experimental-2bf7c02f0-20220314", "react-dom": "0.0.0-experimental-2bf7c02f0-20220314"