diff --git a/.changeset/chilled-baboons-deny.md b/.changeset/chilled-baboons-deny.md deleted file mode 100644 index 731371347d..0000000000 --- a/.changeset/chilled-baboons-deny.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -**Breaking change** - -The utility `isClient` has been renamed to `isBrowser`. This is because the utility really checks if the running context is a browser, _not_ if the context is a client component. - -All client components by default also run on the server when they are server rendered. If you don't want that to happen, use the `isBrowser()` hook. Remember that anything not server rendered will be unavailable for SEO bots. diff --git a/.changeset/clean-lies-greet.md b/.changeset/clean-lies-greet.md deleted file mode 100644 index 0b4feb09ac..0000000000 --- a/.changeset/clean-lies-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Rename internal Hydrogen global variables that could conflict with third party libraries that use the same names. diff --git a/.changeset/cool-spies-study.md b/.changeset/cool-spies-study.md deleted file mode 100644 index d5fe62437a..0000000000 --- a/.changeset/cool-spies-study.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -Add `scroll` prop to `Link` and `navigate` to allow the scroll restoration behavior to be disabled. - -By default, when a `` component is clicked, Hydrogen emulates default browser behavior and attempts to restore the scroll position previously used in the visitor's session. For new pages, this defaults to scrolling to the top of the page. - -However, if you are building a user interface that should fetch a new server components request and update the URL but not modify scroll position, then you can disable scroll restoration using the `scroll` prop: - -```jsx -import {Link} from '@shopify/hydrogen'; -export default function Index({request}) { - const url = new URL(request.normalizedUrl); - - return ( - <> -

Current param is: {url.searchParams.get('param')}

- - Update param to foo - - - ); -} -``` diff --git a/.changeset/fair-rats-sort.md b/.changeset/fair-rats-sort.md deleted file mode 100644 index bdea1e53fc..0000000000 --- a/.changeset/fair-rats-sort.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -With the introduction of authenticated pages, we also now provide the ability to prevent pages from being indexed by bots. You can do so by passing `noindex` to the `Seo` component: - -```jsx - -``` diff --git a/.changeset/famous-lobsters-enjoy.md b/.changeset/famous-lobsters-enjoy.md deleted file mode 100644 index 4acf990379..0000000000 --- a/.changeset/famous-lobsters-enjoy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Improve component bundling to reduce the total amount of JS files downloaded in the browser. diff --git a/.changeset/five-cougars-begin.md b/.changeset/five-cougars-begin.md deleted file mode 100644 index 2b290e764b..0000000000 --- a/.changeset/five-cougars-begin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Reduce CPU consumption when rendering React Server Components. diff --git a/.changeset/fresh-cooks-poke.md b/.changeset/fresh-cooks-poke.md deleted file mode 100644 index 59501a2737..0000000000 --- a/.changeset/fresh-cooks-poke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Confusing warnings that are not actionable have been removed. diff --git a/.changeset/gorgeous-forks-type.md b/.changeset/gorgeous-forks-type.md deleted file mode 100644 index 7d823b070f..0000000000 --- a/.changeset/gorgeous-forks-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'create-hydrogen-app': patch ---- - -Small styling fix to country selector in demo store template diff --git a/.changeset/rich-seals-switch.md b/.changeset/rich-seals-switch.md deleted file mode 100644 index 15df09b605..0000000000 --- a/.changeset/rich-seals-switch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Enable streaming by default for all platforms diff --git a/.changeset/rotten-nails-complain.md b/.changeset/rotten-nails-complain.md deleted file mode 100644 index 97c06142bc..0000000000 --- a/.changeset/rotten-nails-complain.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -**Breaking change**: The `setLogger` and `setLoggerOptions` utilities have been removed. The same information can now be passed under the `logger` property in Hydrogen config: - -```diff -// App.server.jsx - --import {setLogger, setLoggerOptions} from '@shopify/hydrogen'; - --setLogger({ -- trace() {}, -- error() {}, -- // ... --}); - --setLoggerOptions({ -- showQueryTiming: true, -- showCacheControlHeader: true, -- // ... --}); - -function App() { - // ... -} - -export default renderHydrogen(App); -``` - -```diff -// hydrogen.config.js - -export default defineConfig({ - // ... -+ logger: { -+ trace() {}, -+ error() {}, -+ showQueryTiming: true, -+ showCacheControlHeader: true, -+ // ... -+ }, -}); -``` diff --git a/.changeset/rude-yaks-obey.md b/.changeset/rude-yaks-obey.md deleted file mode 100644 index e389657b06..0000000000 --- a/.changeset/rude-yaks-obey.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -The `response.writeHead` method has been removed, while `response.status` and `response.statusText` are now writable. - -```diff -function App({response}) { -- response.writeHead({ -- headers: {'custom-header': 'value'}, -- status: 404, -- }); -+ response.headers.set('custom-header', 'value'); -+ response.status = 404; -} -``` diff --git a/.changeset/sharp-rice-marry.md b/.changeset/sharp-rice-marry.md deleted file mode 100644 index a09cfce49c..0000000000 --- a/.changeset/sharp-rice-marry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Properly support Node v18 diff --git a/.changeset/soft-tools-lay.md b/.changeset/soft-tools-lay.md deleted file mode 100644 index 25b4a9a73b..0000000000 --- a/.changeset/soft-tools-lay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Custom loggers can return promises from their methods. Hydrogen will await for them after the current request is over but before the runtime instance ends. diff --git a/.changeset/spicy-pans-turn.md b/.changeset/spicy-pans-turn.md deleted file mode 100644 index f56702c1f1..0000000000 --- a/.changeset/spicy-pans-turn.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -**Breaking change**: The client configuration, including the `strictMode` option, has been moved from custom client entry handlers to the Hydrogen configuration file. If you had a custom client entry file just to pass client options, you can remove it and do the same in `hydrogen.config.js`: - -```diff -// Custom client entry handler - --renderHydrogen(ClientWrapper, {strictMode: false}); -+renderHydrogen(ClientWrapper); -``` - -```diff -// hydrogen.config.jsx - -export default defineConfig({ -+ strictMode: false, -}); -``` - -To remove a custom client entry handler in case it's not needed anymore, delete the custom file and change `index.html`: - -```diff - -
-- -+ - -``` diff --git a/.changeset/ten-knives-tickle.md b/.changeset/ten-knives-tickle.md deleted file mode 100644 index a090f4a0c8..0000000000 --- a/.changeset/ten-knives-tickle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@shopify/hydrogen': patch ---- - -Workers context (e.g. `waitUntil`) is now scoped to the current request instead of globally available. diff --git a/.changeset/violet-peaches-notice.md b/.changeset/violet-peaches-notice.md deleted file mode 100644 index c14156f112..0000000000 --- a/.changeset/violet-peaches-notice.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -'@shopify/hydrogen': minor ---- - -**Breaking change**: The `enableStreaming` config option has been deprecated. The same feature can be done directly in the app: - -```diff -// hydrogen.config.js - -export default defineConfig({ - shopify: { - // ... - }, -- enableStreaming: (req) => { -- return req.headers.get('user-agent') !== 'custom bot'; -- }, -}); -``` - -```diff -// App.server.jsx - --function App() { -+function App({request, response}) { -+ if (request.headers.get('user-agent') === 'custom bot') { -+ response.doNotStream(); -+ } - - return {/*...*/}; -} - -export default renderHydrogen(App); -``` diff --git a/packages/create-hydrogen-app/CHANGELOG.md b/packages/create-hydrogen-app/CHANGELOG.md index ac93787b14..4c07f52857 100644 --- a/packages/create-hydrogen-app/CHANGELOG.md +++ b/packages/create-hydrogen-app/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.23.0 + +### Patch Changes + +- [#1415](https://github.com/Shopify/hydrogen/pull/1415) [`43f96465`](https://github.com/Shopify/hydrogen/commit/43f964653ea3b08c11c2482ae71da1726694be2a) Thanks [@BradMurchison](https://github.com/BradMurchison)! - Small styling fix to country selector in demo store template + ## 0.22.1 ## 0.22.0 diff --git a/packages/create-hydrogen-app/package.json b/packages/create-hydrogen-app/package.json index 3335f93789..7f7f9a1a91 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.22.1", + "version": "0.23.0", "main": "index.js", "license": "MIT", "bin": { diff --git a/packages/hydrogen/CHANGELOG.md b/packages/hydrogen/CHANGELOG.md index a86d7ebd65..35c4637cbe 100644 --- a/packages/hydrogen/CHANGELOG.md +++ b/packages/hydrogen/CHANGELOG.md @@ -1,5 +1,172 @@ # Changelog +## 0.23.0 + +### Minor Changes + +- [#1389](https://github.com/Shopify/hydrogen/pull/1389) [`9a21108f`](https://github.com/Shopify/hydrogen/commit/9a21108f6ff89474db9ff8bec26733fcbe744bdc) Thanks [@blittle](https://github.com/blittle)! - **Breaking change** + + The utility `isClient` has been renamed to `isBrowser`. This is because the utility really checks if the running context is a browser, _not_ if the context is a client component. + + All client components by default also run on the server when they are server rendered. If you don't want that to happen, use the `isBrowser()` hook. Remember that anything not server rendered will be unavailable for SEO bots. + +* [#1431](https://github.com/Shopify/hydrogen/pull/1431) [`6975bdb9`](https://github.com/Shopify/hydrogen/commit/6975bdb90cfdc03562d21cec09150c52ff31ff78) Thanks [@jplhomer](https://github.com/jplhomer)! - Add `scroll` prop to `Link` and `navigate` to allow the scroll restoration behavior to be disabled. + + By default, when a `` component is clicked, Hydrogen emulates default browser behavior and attempts to restore the scroll position previously used in the visitor's session. For new pages, this defaults to scrolling to the top of the page. + + However, if you are building a user interface that should fetch a new server components request and update the URL but not modify scroll position, then you can disable scroll restoration using the `scroll` prop: + + ```jsx + import {Link} from '@shopify/hydrogen'; + export default function Index({request}) { + const url = new URL(request.normalizedUrl); + + return ( + <> +

Current param is: {url.searchParams.get('param')}

+ + Update param to foo + + + ); + } + ``` + +- [#1334](https://github.com/Shopify/hydrogen/pull/1334) [`58e039d4`](https://github.com/Shopify/hydrogen/commit/58e039d45cf69b670628f9f7ea62cb7c2d8425d9) Thanks [@blittle](https://github.com/blittle)! - With the introduction of authenticated pages, we also now provide the ability to prevent pages from being indexed by bots. You can do so by passing `noindex` to the `Seo` component: + + ```jsx + + ``` + +* [#1403](https://github.com/Shopify/hydrogen/pull/1403) [`979f8177`](https://github.com/Shopify/hydrogen/commit/979f81775a4bfa83276030da07cb012e6cb08e2f) Thanks [@frandiox](https://github.com/frandiox)! - **Breaking change**: The `setLogger` and `setLoggerOptions` utilities have been removed. The same information can now be passed under the `logger` property in Hydrogen config: + + ```diff + // App.server.jsx + + -import {setLogger, setLoggerOptions} from '@shopify/hydrogen'; + + -setLogger({ + - trace() {}, + - error() {}, + - // ... + -}); + + -setLoggerOptions({ + - showQueryTiming: true, + - showCacheControlHeader: true, + - // ... + -}); + + function App() { + // ... + } + + export default renderHydrogen(App); + ``` + + ```diff + // hydrogen.config.js + + export default defineConfig({ + // ... + + logger: { + + trace() {}, + + error() {}, + + showQueryTiming: true, + + showCacheControlHeader: true, + + // ... + + }, + }); + ``` + +- [#1433](https://github.com/Shopify/hydrogen/pull/1433) [`cd354d3a`](https://github.com/Shopify/hydrogen/commit/cd354d3a6205b5a8ef14426040121ac620c8c158) Thanks [@frandiox](https://github.com/frandiox)! - The `response.writeHead` method has been removed, while `response.status` and `response.statusText` are now writable. + + ```diff + function App({response}) { + - response.writeHead({ + - headers: {'custom-header': 'value'}, + - status: 404, + - }); + + response.headers.set('custom-header', 'value'); + + response.status = 404; + } + ``` + +* [#1418](https://github.com/Shopify/hydrogen/pull/1418) [`512cb009`](https://github.com/Shopify/hydrogen/commit/512cb009fadeb1907fafa2cef8b568081799335f) Thanks [@frandiox](https://github.com/frandiox)! - **Breaking change**: The client configuration, including the `strictMode` option, has been moved from custom client entry handlers to the Hydrogen configuration file. If you had a custom client entry file just to pass client options, you can remove it and do the same in `hydrogen.config.js`: + + ```diff + // Custom client entry handler + + -renderHydrogen(ClientWrapper, {strictMode: false}); + +renderHydrogen(ClientWrapper); + ``` + + ```diff + // hydrogen.config.jsx + + export default defineConfig({ + + strictMode: false, + }); + ``` + + To remove a custom client entry handler in case it's not needed anymore, delete the custom file and change `index.html`: + + ```diff + +
+ - + + + + ``` + +- [#1401](https://github.com/Shopify/hydrogen/pull/1401) [`335b70ce`](https://github.com/Shopify/hydrogen/commit/335b70ce67f9f137875fcd18f32e00c1b1b4c533) Thanks [@frandiox](https://github.com/frandiox)! - **Breaking change**: The `enableStreaming` config option has been deprecated. The same feature can be done directly in the app: + + ```diff + // hydrogen.config.js + + export default defineConfig({ + shopify: { + // ... + }, + - enableStreaming: (req) => { + - return req.headers.get('user-agent') !== 'custom bot'; + - }, + }); + ``` + + ```diff + // App.server.jsx + + -function App() { + +function App({request, response}) { + + if (request.headers.get('user-agent') === 'custom bot') { + + response.doNotStream(); + + } + + return {/*...*/}; + } + + export default renderHydrogen(App); + ``` + +### Patch Changes + +- [#1425](https://github.com/Shopify/hydrogen/pull/1425) [`e213aa86`](https://github.com/Shopify/hydrogen/commit/e213aa8656b17bf649fef714befa99b9618aae45) Thanks [@frandiox](https://github.com/frandiox)! - Rename internal Hydrogen global variables that could conflict with third party libraries that use the same names. + +* [#1361](https://github.com/Shopify/hydrogen/pull/1361) [`cf2ef664`](https://github.com/Shopify/hydrogen/commit/cf2ef664cd1e91bc53fc34698ac23797c398e74f) Thanks [@frandiox](https://github.com/frandiox)! - Improve component bundling to reduce the total amount of JS files downloaded in the browser. + +- [#1452](https://github.com/Shopify/hydrogen/pull/1452) [`ed1586a7`](https://github.com/Shopify/hydrogen/commit/ed1586a758fd36bddcc422a75db8a7971ce946d5) Thanks [@frandiox](https://github.com/frandiox)! - Reduce CPU consumption when rendering React Server Components. + +* [#1399](https://github.com/Shopify/hydrogen/pull/1399) [`583ce40c`](https://github.com/Shopify/hydrogen/commit/583ce40c97391bb22e6e15e736e6237e9a1ea085) Thanks [@frandiox](https://github.com/frandiox)! - Confusing warnings that are not actionable have been removed. + +- [#1227](https://github.com/Shopify/hydrogen/pull/1227) [`8eae0a07`](https://github.com/Shopify/hydrogen/commit/8eae0a07ab02e61ac8742e42488825090ca0aa37) Thanks [@jplhomer](https://github.com/jplhomer)! - Enable streaming by default for all platforms + +* [#1427](https://github.com/Shopify/hydrogen/pull/1427) [`7115d7d8`](https://github.com/Shopify/hydrogen/commit/7115d7d8dc291b7e5b4dda200baf8a906a005cc8) Thanks [@jplhomer](https://github.com/jplhomer)! - Properly support Node v18 + +- [#1424](https://github.com/Shopify/hydrogen/pull/1424) [`446c12bf`](https://github.com/Shopify/hydrogen/commit/446c12bffa08eadccfd27afe8b5f34c77a61d134) Thanks [@frandiox](https://github.com/frandiox)! - Custom loggers can return promises from their methods. Hydrogen will await for them after the current request is over but before the runtime instance ends. + +* [#1423](https://github.com/Shopify/hydrogen/pull/1423) [`aaf9efa4`](https://github.com/Shopify/hydrogen/commit/aaf9efa45dc9453e95be8e3020c259368ac5f4d0) Thanks [@frandiox](https://github.com/frandiox)! - Workers context (e.g. `waitUntil`) is now scoped to the current request instead of globally available. + ## 0.22.1 ### Patch Changes diff --git a/packages/hydrogen/package.json b/packages/hydrogen/package.json index 6cb98299b6..05da67b933 100644 --- a/packages/hydrogen/package.json +++ b/packages/hydrogen/package.json @@ -7,7 +7,7 @@ "engines": { "node": ">=14" }, - "version": "0.22.1", + "version": "0.23.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 06a9eb5d41..3b702c1251 100644 --- a/packages/hydrogen/src/version.ts +++ b/packages/hydrogen/src/version.ts @@ -1 +1 @@ -export const LIB_VERSION = '0.22.1'; +export const LIB_VERSION = '0.23.0'; diff --git a/packages/playground/async-config/package.json b/packages/playground/async-config/package.json index 595f5b5f15..a510b6c6c4 100644 --- a/packages/playground/async-config/package.json +++ b/packages/playground/async-config/package.json @@ -17,7 +17,7 @@ }, "dependencies": { "@cloudflare/kv-asset-handler": "*", - "@shopify/hydrogen": "^0.22.1", + "@shopify/hydrogen": "^0.23.0", "miniflare": "^1.3.3", "react": "^18.1.0", "react-dom": "^18.1.0" diff --git a/packages/playground/server-components/package.json b/packages/playground/server-components/package.json index fd0edeffb8..9fca3733b1 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.22.1", + "@shopify/hydrogen": "^0.23.0", "miniflare": "^1.3.3", "react": "^18.1.0", "react-dom": "^18.1.0" diff --git a/templates/demo-store/package.json b/templates/demo-store/package.json index 3b03c7d348..269a05ca25 100644 --- a/templates/demo-store/package.json +++ b/templates/demo-store/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@headlessui/react": "^1.5.0", - "@shopify/hydrogen": "^0.22.1", + "@shopify/hydrogen": "^0.23.0", "body-parser": "^1.20.0", "compression": "^1.7.4", "react": "^18.1.0", diff --git a/templates/hello-world/package.json b/templates/hello-world/package.json index 3a81be0a5d..5386d07ae4 100644 --- a/templates/hello-world/package.json +++ b/templates/hello-world/package.json @@ -15,7 +15,7 @@ "vite": "^2.9.0" }, "dependencies": { - "@shopify/hydrogen": "^0.22.1", + "@shopify/hydrogen": "^0.23.0", "react": "^18.1.0", "react-dom": "^18.1.0" }