@shopify/create-hydrogen 5.0.22 → 5.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/hydrogen/starter/.cursor/rules/hydrogen-react-router.mdc +52 -0
- package/dist/assets/hydrogen/starter/CHANGELOG.md +53 -51
- package/dist/assets/hydrogen/starter/app/components/AddToCartButton.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/CartLineItem.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/Footer.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/Header.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/PageLayout.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/ProductForm.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/ProductItem.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/SearchForm.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/SearchFormPredictive.tsx +1 -6
- package/dist/assets/hydrogen/starter/app/components/SearchResults.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/components/SearchResultsPredictive.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/entry.client.tsx +2 -2
- package/dist/assets/hydrogen/starter/app/entry.server.tsx +9 -4
- package/dist/assets/hydrogen/starter/app/lib/variants.ts +1 -1
- package/dist/assets/hydrogen/starter/app/root.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/_index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/account.orders.$id.tsx +4 -4
- package/dist/assets/hydrogen/starter/app/routes/account.orders._index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -7
- package/dist/assets/hydrogen/starter/app/routes/account.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +14 -0
- package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle.$articleHandle.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle._index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/blogs._index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/cart.tsx +7 -2
- package/dist/assets/hydrogen/starter/app/routes/collections.$handle.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/collections._index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/collections.all.tsx +2 -2
- package/dist/assets/hydrogen/starter/app/routes/pages.$handle.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/policies.$handle.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/policies._index.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/products.$handle.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes/search.tsx +1 -1
- package/dist/assets/hydrogen/starter/app/routes.ts +2 -2
- package/dist/assets/hydrogen/starter/env.d.ts +12 -2
- package/dist/assets/hydrogen/starter/eslint.config.js +2 -0
- package/dist/assets/hydrogen/starter/package.json +11 -12
- package/dist/assets/hydrogen/starter/react-router.config.ts +7 -0
- package/dist/assets/hydrogen/starter/server.ts +2 -5
- package/dist/assets/hydrogen/starter/tsconfig.json +18 -6
- package/dist/assets/hydrogen/starter/vite.config.ts +2 -23
- package/dist/assets/hydrogen/virtual-routes/components/RequestDetails.jsx +1 -1
- package/dist/assets/hydrogen/virtual-routes/layout.jsx +1 -7
- package/dist/assets/hydrogen/virtual-routes/routes/index.jsx +1 -1
- package/dist/assets/hydrogen/virtual-routes/routes/subrequest-profiler.jsx +1 -1
- package/dist/assets/hydrogen/virtual-routes/virtual-root-with-layout.jsx +1 -1
- package/dist/assets/hydrogen/virtual-routes/virtual-root.jsx +1 -1
- package/dist/assets/hydrogen/vite/vite.config.js +1 -1
- package/dist/{chunk-NIHY2BIB.js → chunk-QUKX7CP5.js} +19 -19
- package/dist/create-app.js +167 -166
- package/dist/{error-handler-O653XSNU.js → error-handler-YXM2BB34.js} +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# React Router Import Rule for Hydrogen
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This Hydrogen project is based on React Router, not Remix. When working with documentation or code examples, you should always use imports from the appropriate React Router packages instead of Remix packages.
|
|
12
|
+
|
|
13
|
+
## Import Replacements
|
|
14
|
+
|
|
15
|
+
When you see imports from Remix packages, replace them with their equivalent React Router v7 packages. Here are the common replacements:
|
|
16
|
+
|
|
17
|
+
| Remix v2 Package | React Router v7 Package |
|
|
18
|
+
|------------------|-------------------------|
|
|
19
|
+
| `@remix-run/react` | `react-router` |
|
|
20
|
+
| `@remix-run/dev` | `@react-router/dev` |
|
|
21
|
+
| `@remix-run/architect` | `@react-router/architect` |
|
|
22
|
+
| `@remix-run/cloudflare` | `@react-router/cloudflare` |
|
|
23
|
+
| `@remix-run/express` | `@react-router/express` |
|
|
24
|
+
| `@remix-run/fs-routes` | `@react-router/fs-routes` |
|
|
25
|
+
| `@remix-run/node` | `@react-router/node` |
|
|
26
|
+
| `@remix-run/route-config` | `@react-router/dev` |
|
|
27
|
+
| `@remix-run/routes-option-adapter` | `@react-router/remix-routes-option-adapter` |
|
|
28
|
+
| `@remix-run/serve` | `@react-router/serve` |
|
|
29
|
+
| `@remix-run/server-runtime` | `react-router` |
|
|
30
|
+
| `@remix-run/testing` | `react-router` |
|
|
31
|
+
|
|
32
|
+
NEVER USE 'react-router-dom' imports!
|
|
33
|
+
|
|
34
|
+
## Common Import Examples
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// INCORRECT (Remix style)
|
|
38
|
+
import { useLoaderData, Link, Form, useActionData, useNavigation, useSubmit } from '@remix-run/react';
|
|
39
|
+
|
|
40
|
+
// CORRECT (React Router style)
|
|
41
|
+
import { useLoaderData, Link, Form, useActionData, useNavigation, useSubmit } from 'react-router';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Development Guidelines
|
|
45
|
+
|
|
46
|
+
1. Always check existing code in the project to understand which specific React Router hooks and components are being used
|
|
47
|
+
2. When generating new code or modifying existing code, ensure all routing-related imports come from the correct React Router packages
|
|
48
|
+
3. If following documentation or examples based on Remix, adapt the code to use React Router equivalents
|
|
49
|
+
|
|
50
|
+
When working in this codebase, always follow the React Router patterns that are already established in the existing code.
|
|
51
|
+
|
|
52
|
+
For more information, consult the official Remix to React Router upgrade guide: https://reactrouter.com/upgrading/remix
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
# skeleton
|
|
2
2
|
|
|
3
|
-
## 2025.
|
|
3
|
+
## 2025.5.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Bumping the cli to 3.80.4 ([#2956](https://github.com/Shopify/hydrogen/pull/2956)) by [@balazsbajorics](https://github.com/balazsbajorics)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 2025.5.0
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Patch Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- Migrating to React Router 7 ([#2866](https://github.com/Shopify/hydrogen/pull/2866)) by [@balazsbajorics](https://github.com/balazsbajorics)
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- Updated dependencies [[`e9132d88`](https://github.com/Shopify/hydrogen/commit/e9132d8888ad090d3db41fe4d5d63569a30e9d8e), [`e9132d88`](https://github.com/Shopify/hydrogen/commit/e9132d8888ad090d3db41fe4d5d63569a30e9d8e)]:
|
|
16
|
+
- @shopify/remix-oxygen@3.0.0
|
|
17
|
+
- @shopify/hydrogen@2025.5.0
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
## 2025.4.0
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
### Patch Changes
|
|
20
22
|
|
|
21
|
-
-
|
|
23
|
+
- Moved the Cursor rules into more generic LLM prompt files. If you were using the Cursor rules, you will find the prompts in the `cookbook/llms` folder and they can be put into your `.cursor/rules` folder manually. LLM prompt files will be maintained moving forward, while previous Cursor rules will not be updated anymore. ([#2936](https://github.com/Shopify/hydrogen/pull/2936)) by [@ruggishop](https://github.com/ruggishop)
|
|
22
24
|
|
|
23
|
-
- Bump
|
|
25
|
+
- Bump skeleton @shopify/cli and @shopify/mini-oxygen ([#2883](https://github.com/Shopify/hydrogen/pull/2883)) by [@juanpprieto](https://github.com/juanpprieto)
|
|
24
26
|
|
|
25
|
-
-
|
|
27
|
+
- Update SFAPI and CAAPI versions to 2025.04 ([#2886](https://github.com/Shopify/hydrogen/pull/2886)) by [@juanpprieto](https://github.com/juanpprieto)
|
|
26
28
|
|
|
27
29
|
- Updated dependencies [[`af23e710`](https://github.com/Shopify/hydrogen/commit/af23e710dac83bb57498d9c2ef1d8bcf9df55d34), [`9d8a6644`](https://github.com/Shopify/hydrogen/commit/9d8a6644a5b67dca890c6687df390aee78fc85c3)]:
|
|
28
30
|
- @shopify/hydrogen@2025.4.0
|
|
@@ -164,13 +166,13 @@
|
|
|
164
166
|
1. Add a routes.ts file. This is your new Remix route configuration file.
|
|
165
167
|
|
|
166
168
|
```ts
|
|
167
|
-
import {flatRoutes} from
|
|
168
|
-
import {layout, type RouteConfig} from
|
|
169
|
-
import {hydrogenRoutes} from
|
|
169
|
+
import { flatRoutes } from "@remix-run/fs-routes";
|
|
170
|
+
import { layout, type RouteConfig } from "@remix-run/route-config";
|
|
171
|
+
import { hydrogenRoutes } from "@shopify/hydrogen";
|
|
170
172
|
|
|
171
173
|
export default hydrogenRoutes([
|
|
172
174
|
// Your entire app reading from routes folder using Layout from layout.tsx
|
|
173
|
-
layout(
|
|
175
|
+
layout("./layout.tsx", await flatRoutes()),
|
|
174
176
|
]) satisfies RouteConfig;
|
|
175
177
|
```
|
|
176
178
|
|
|
@@ -761,25 +763,25 @@
|
|
|
761
763
|
8. Update the `ProductForm` component.
|
|
762
764
|
|
|
763
765
|
```tsx
|
|
764
|
-
import {Link, useNavigate} from
|
|
765
|
-
import {type MappedProductOptions} from
|
|
766
|
+
import { Link, useNavigate } from "@remix-run/react";
|
|
767
|
+
import { type MappedProductOptions } from "@shopify/hydrogen";
|
|
766
768
|
import type {
|
|
767
769
|
Maybe,
|
|
768
770
|
ProductOptionValueSwatch,
|
|
769
|
-
} from
|
|
770
|
-
import {AddToCartButton} from
|
|
771
|
-
import {useAside} from
|
|
772
|
-
import type {ProductFragment} from
|
|
771
|
+
} from "@shopify/hydrogen/storefront-api-types";
|
|
772
|
+
import { AddToCartButton } from "./AddToCartButton";
|
|
773
|
+
import { useAside } from "./Aside";
|
|
774
|
+
import type { ProductFragment } from "storefrontapi.generated";
|
|
773
775
|
|
|
774
776
|
export function ProductForm({
|
|
775
777
|
productOptions,
|
|
776
778
|
selectedVariant,
|
|
777
779
|
}: {
|
|
778
780
|
productOptions: MappedProductOptions[];
|
|
779
|
-
selectedVariant: ProductFragment[
|
|
781
|
+
selectedVariant: ProductFragment["selectedOrFirstAvailableVariant"];
|
|
780
782
|
}) {
|
|
781
783
|
const navigate = useNavigate();
|
|
782
|
-
const {open} = useAside();
|
|
784
|
+
const { open } = useAside();
|
|
783
785
|
return (
|
|
784
786
|
<div className="product-form">
|
|
785
787
|
{productOptions.map((option) => (
|
|
@@ -813,8 +815,8 @@
|
|
|
813
815
|
to={`/products/${handle}?${variantUriQuery}`}
|
|
814
816
|
style={{
|
|
815
817
|
border: selected
|
|
816
|
-
?
|
|
817
|
-
:
|
|
818
|
+
? "1px solid black"
|
|
819
|
+
: "1px solid transparent",
|
|
818
820
|
opacity: available ? 1 : 0.3,
|
|
819
821
|
}}
|
|
820
822
|
>
|
|
@@ -831,13 +833,13 @@
|
|
|
831
833
|
<button
|
|
832
834
|
type="button"
|
|
833
835
|
className={`product-options-item${
|
|
834
|
-
exists && !selected ?
|
|
836
|
+
exists && !selected ? " link" : ""
|
|
835
837
|
}`}
|
|
836
838
|
key={option.name + name}
|
|
837
839
|
style={{
|
|
838
840
|
border: selected
|
|
839
|
-
?
|
|
840
|
-
:
|
|
841
|
+
? "1px solid black"
|
|
842
|
+
: "1px solid transparent",
|
|
841
843
|
opacity: available ? 1 : 0.3,
|
|
842
844
|
}}
|
|
843
845
|
disabled={!exists}
|
|
@@ -861,7 +863,7 @@
|
|
|
861
863
|
<AddToCartButton
|
|
862
864
|
disabled={!selectedVariant || !selectedVariant.availableForSale}
|
|
863
865
|
onClick={() => {
|
|
864
|
-
open(
|
|
866
|
+
open("cart");
|
|
865
867
|
}}
|
|
866
868
|
lines={
|
|
867
869
|
selectedVariant
|
|
@@ -875,7 +877,7 @@
|
|
|
875
877
|
: []
|
|
876
878
|
}
|
|
877
879
|
>
|
|
878
|
-
{selectedVariant?.availableForSale ?
|
|
880
|
+
{selectedVariant?.availableForSale ? "Add to cart" : "Sold out"}
|
|
879
881
|
</AddToCartButton>
|
|
880
882
|
</div>
|
|
881
883
|
);
|
|
@@ -898,7 +900,7 @@
|
|
|
898
900
|
aria-label={name}
|
|
899
901
|
className="product-option-label-swatch"
|
|
900
902
|
style={{
|
|
901
|
-
backgroundColor: color ||
|
|
903
|
+
backgroundColor: color || "transparent",
|
|
902
904
|
}}
|
|
903
905
|
>
|
|
904
906
|
{!!image && <img src={image} alt={name} />}
|
|
@@ -1399,21 +1401,21 @@
|
|
|
1399
1401
|
New `withCache.fetch` is for caching simple fetch requests. This method caches the responses if they are OK responses, and you can pass `shouldCacheResponse`, `cacheKey`, etc. to modify behavior. `data` is the consumed body of the response (we need to consume to cache it).
|
|
1400
1402
|
|
|
1401
1403
|
```ts
|
|
1402
|
-
const withCache = createWithCache({cache, waitUntil, request});
|
|
1404
|
+
const withCache = createWithCache({ cache, waitUntil, request });
|
|
1403
1405
|
|
|
1404
|
-
const {data, response} = await withCache.fetch<{data: T; error: string}>(
|
|
1405
|
-
|
|
1406
|
+
const { data, response } = await withCache.fetch<{ data: T; error: string }>(
|
|
1407
|
+
"my-cms.com/api",
|
|
1406
1408
|
{
|
|
1407
|
-
method:
|
|
1408
|
-
headers: {
|
|
1409
|
+
method: "POST",
|
|
1410
|
+
headers: { "Content-type": "application/json" },
|
|
1409
1411
|
body,
|
|
1410
1412
|
},
|
|
1411
1413
|
{
|
|
1412
1414
|
cacheStrategy: CacheLong(),
|
|
1413
1415
|
// Cache if there are no data errors or a specific data that make this result not suited for caching
|
|
1414
1416
|
shouldCacheResponse: (result) => !result?.error,
|
|
1415
|
-
cacheKey: [
|
|
1416
|
-
displayName:
|
|
1417
|
+
cacheKey: ["my-cms", body],
|
|
1418
|
+
displayName: "My CMS query",
|
|
1417
1419
|
},
|
|
1418
1420
|
);
|
|
1419
1421
|
```
|
|
@@ -1989,9 +1991,9 @@
|
|
|
1989
1991
|
|
|
1990
1992
|
```tsx
|
|
1991
1993
|
// app/lib/root-data.ts
|
|
1992
|
-
import {useMatches} from
|
|
1993
|
-
import type {SerializeFrom} from
|
|
1994
|
-
import type {loader} from
|
|
1994
|
+
import { useMatches } from "@remix-run/react";
|
|
1995
|
+
import type { SerializeFrom } from "@shopify/remix-oxygen";
|
|
1996
|
+
import type { loader } from "~/root";
|
|
1995
1997
|
|
|
1996
1998
|
/**
|
|
1997
1999
|
* Access the result of the root loader from a React component.
|
|
@@ -2153,10 +2155,10 @@
|
|
|
2153
2155
|
- This is an important fix to a bug with 404 routes and path-based i18n projects where some unknown routes would not properly render a 404. This fixes all new projects, but to fix existing projects, add a `($locale).tsx` route with the following contents: ([#1732](https://github.com/Shopify/hydrogen/pull/1732)) by [@blittle](https://github.com/blittle)
|
|
2154
2156
|
|
|
2155
2157
|
```ts
|
|
2156
|
-
import {type LoaderFunctionArgs} from
|
|
2158
|
+
import { type LoaderFunctionArgs } from "@remix-run/server-runtime";
|
|
2157
2159
|
|
|
2158
|
-
export async function loader({params, context}: LoaderFunctionArgs) {
|
|
2159
|
-
const {language, country} = context.storefront.i18n;
|
|
2160
|
+
export async function loader({ params, context }: LoaderFunctionArgs) {
|
|
2161
|
+
const { language, country } = context.storefront.i18n;
|
|
2160
2162
|
|
|
2161
2163
|
if (
|
|
2162
2164
|
params.locale &&
|
|
@@ -2164,7 +2166,7 @@
|
|
|
2164
2166
|
) {
|
|
2165
2167
|
// If the locale URL param is defined, yet we still are still at the default locale
|
|
2166
2168
|
// then the the locale param must be invalid, send to the 404 page
|
|
2167
|
-
throw new Response(null, {status: 404});
|
|
2169
|
+
throw new Response(null, { status: 404 });
|
|
2168
2170
|
}
|
|
2169
2171
|
|
|
2170
2172
|
return null;
|
|
@@ -2220,11 +2222,11 @@
|
|
|
2220
2222
|
```yaml
|
|
2221
2223
|
projects:
|
|
2222
2224
|
default:
|
|
2223
|
-
schema:
|
|
2225
|
+
schema: "node_modules/@shopify/hydrogen/storefront.schema.json"
|
|
2224
2226
|
documents:
|
|
2225
|
-
-
|
|
2226
|
-
-
|
|
2227
|
-
-
|
|
2227
|
+
- "!*.d.ts"
|
|
2228
|
+
- "*.{ts,tsx,js,jsx}"
|
|
2229
|
+
- "app/**/*.{ts,tsx,js,jsx}"
|
|
2228
2230
|
```
|
|
2229
2231
|
|
|
2230
2232
|
- Improve resiliency of `HydrogenSession` ([#1583](https://github.com/Shopify/hydrogen/pull/1583)) by [@blittle](https://github.com/blittle)
|
|
@@ -2439,8 +2441,8 @@
|
|
|
2439
2441
|
```ts
|
|
2440
2442
|
// root.tsx
|
|
2441
2443
|
|
|
2442
|
-
import {useMatches} from
|
|
2443
|
-
import {type SerializeFrom} from
|
|
2444
|
+
import { useMatches } from "@remix-run/react";
|
|
2445
|
+
import { type SerializeFrom } from "@shopify/remix-oxygen";
|
|
2444
2446
|
|
|
2445
2447
|
export const useRootLoaderData = () => {
|
|
2446
2448
|
const [root] = useMatches();
|
|
@@ -2,7 +2,7 @@ import type {CartLineUpdateInput} from '@shopify/hydrogen/storefront-api-types';
|
|
|
2
2
|
import type {CartLayout} from '~/components/CartMain';
|
|
3
3
|
import {CartForm, Image, type OptimisticCartLine} from '@shopify/hydrogen';
|
|
4
4
|
import {useVariantUrl} from '~/lib/variants';
|
|
5
|
-
import {Link} from '
|
|
5
|
+
import { Link } from 'react-router';
|
|
6
6
|
import {ProductPrice} from './ProductPrice';
|
|
7
7
|
import {useAside} from './Aside';
|
|
8
8
|
import type {CartApiQueryFragment} from 'storefrontapi.generated';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useOptimisticCart} from '@shopify/hydrogen';
|
|
2
|
-
import {Link} from '
|
|
2
|
+
import { Link } from 'react-router';
|
|
3
3
|
import type {CartApiQueryFragment} from 'storefrontapi.generated';
|
|
4
4
|
import {useAside} from '~/components/Aside';
|
|
5
5
|
import {CartLineItem} from '~/components/CartLineItem';
|
|
@@ -2,7 +2,7 @@ import type {CartApiQueryFragment} from 'storefrontapi.generated';
|
|
|
2
2
|
import type {CartLayout} from '~/components/CartMain';
|
|
3
3
|
import {CartForm, Money, type OptimisticCart} from '@shopify/hydrogen';
|
|
4
4
|
import {useRef} from 'react';
|
|
5
|
-
import {FetcherWithComponents} from '
|
|
5
|
+
import { FetcherWithComponents } from 'react-router';
|
|
6
6
|
|
|
7
7
|
type CartSummaryProps = {
|
|
8
8
|
cart: OptimisticCart<CartApiQueryFragment | null>;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useFetcher,
|
|
3
|
-
useNavigate,
|
|
4
|
-
type FormProps,
|
|
5
|
-
type Fetcher,
|
|
6
|
-
} from '@remix-run/react';
|
|
1
|
+
import { useFetcher, useNavigate, type FormProps, type Fetcher } from 'react-router';
|
|
7
2
|
import React, {useRef, useEffect} from 'react';
|
|
8
3
|
import type {PredictiveSearchReturn} from '~/lib/search';
|
|
9
4
|
import {useAside} from './Aside';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HydratedRouter } from 'react-router/dom';
|
|
2
2
|
import {startTransition, StrictMode} from 'react';
|
|
3
3
|
import {hydrateRoot} from 'react-dom/client';
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ if (!window.location.origin.includes('webcache.googleusercontent.com')) {
|
|
|
7
7
|
hydrateRoot(
|
|
8
8
|
document,
|
|
9
9
|
<StrictMode>
|
|
10
|
-
<
|
|
10
|
+
<HydratedRouter />
|
|
11
11
|
</StrictMode>,
|
|
12
12
|
);
|
|
13
13
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type {AppLoadContext} from '@shopify/remix-oxygen';
|
|
2
|
+
import {ServerRouter} from 'react-router';
|
|
3
3
|
import {isbot} from 'isbot';
|
|
4
4
|
import {renderToReadableStream} from 'react-dom/server';
|
|
5
5
|
import {createContentSecurityPolicy} from '@shopify/hydrogen';
|
|
6
|
+
import type {EntryContext} from 'react-router';
|
|
6
7
|
|
|
7
8
|
export default async function handleRequest(
|
|
8
9
|
request: Request,
|
|
9
10
|
responseStatusCode: number,
|
|
10
11
|
responseHeaders: Headers,
|
|
11
|
-
|
|
12
|
+
reactRouterContext: EntryContext,
|
|
12
13
|
context: AppLoadContext,
|
|
13
14
|
) {
|
|
14
15
|
const {nonce, header, NonceProvider} = createContentSecurityPolicy({
|
|
@@ -20,7 +21,11 @@ export default async function handleRequest(
|
|
|
20
21
|
|
|
21
22
|
const body = await renderToReadableStream(
|
|
22
23
|
<NonceProvider>
|
|
23
|
-
<
|
|
24
|
+
<ServerRouter
|
|
25
|
+
context={reactRouterContext}
|
|
26
|
+
url={request.url}
|
|
27
|
+
nonce={nonce}
|
|
28
|
+
/>
|
|
24
29
|
</NonceProvider>,
|
|
25
30
|
{
|
|
26
31
|
nonce,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Scripts,
|
|
11
11
|
ScrollRestoration,
|
|
12
12
|
useRouteLoaderData,
|
|
13
|
-
} from '
|
|
13
|
+
} from 'react-router';
|
|
14
14
|
import favicon from '~/assets/favicon.svg';
|
|
15
15
|
import {FOOTER_QUERY, HEADER_QUERY} from '~/lib/fragments';
|
|
16
16
|
import resetStyles from '~/styles/reset.css?url';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {Await, useLoaderData, Link, type MetaFunction} from '
|
|
2
|
+
import { Await, useLoaderData, Link, type MetaFunction } from 'react-router';
|
|
3
3
|
import {Suspense} from 'react';
|
|
4
4
|
import {Image, Money} from '@shopify/hydrogen';
|
|
5
5
|
import type {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {redirect, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {useLoaderData, type MetaFunction} from '
|
|
2
|
+
import { useLoaderData, type MetaFunction } from 'react-router';
|
|
3
3
|
import {Money, Image, flattenConnection} from '@shopify/hydrogen';
|
|
4
4
|
import type {OrderLineItemFullFragment} from 'customer-accountapi.generated';
|
|
5
5
|
import {CUSTOMER_ORDER_QUERY} from '~/graphql/customer-account/CustomerOrderQuery';
|
|
@@ -60,7 +60,7 @@ export default function OrderRoute() {
|
|
|
60
60
|
fulfillmentStatus,
|
|
61
61
|
} = useLoaderData<typeof loader>();
|
|
62
62
|
return (
|
|
63
|
-
<div className="account-order">
|
|
63
|
+
(<div className="account-order">
|
|
64
64
|
<h2>Order {order.name}</h2>
|
|
65
65
|
<p>Placed on {new Date(order.processedAt!).toDateString()}</p>
|
|
66
66
|
<br />
|
|
@@ -77,7 +77,7 @@ export default function OrderRoute() {
|
|
|
77
77
|
<tbody>
|
|
78
78
|
{lineItems.map((lineItem, lineItemIndex) => (
|
|
79
79
|
// eslint-disable-next-line react/no-array-index-key
|
|
80
|
-
<OrderLineRow key={lineItemIndex} lineItem={lineItem} />
|
|
80
|
+
(<OrderLineRow key={lineItemIndex} lineItem={lineItem} />)
|
|
81
81
|
))}
|
|
82
82
|
</tbody>
|
|
83
83
|
<tfoot>
|
|
@@ -165,7 +165,7 @@ export default function OrderRoute() {
|
|
|
165
165
|
View Order Status →
|
|
166
166
|
</a>
|
|
167
167
|
</p>
|
|
168
|
-
</div>
|
|
168
|
+
</div>)
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -6,13 +6,7 @@ import {
|
|
|
6
6
|
type ActionFunctionArgs,
|
|
7
7
|
type LoaderFunctionArgs,
|
|
8
8
|
} from '@shopify/remix-oxygen';
|
|
9
|
-
import {
|
|
10
|
-
Form,
|
|
11
|
-
useActionData,
|
|
12
|
-
useNavigation,
|
|
13
|
-
useOutletContext,
|
|
14
|
-
type MetaFunction,
|
|
15
|
-
} from '@remix-run/react';
|
|
9
|
+
import { Form, useActionData, useNavigation, useOutletContext, type MetaFunction } from 'react-router';
|
|
16
10
|
|
|
17
11
|
export type ActionResponse = {
|
|
18
12
|
error: string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {data as remixData, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {Form, NavLink, Outlet, useLoaderData} from '
|
|
2
|
+
import { Form, NavLink, Outlet, useLoaderData } from 'react-router';
|
|
3
3
|
import {CUSTOMER_DETAILS_QUERY} from '~/graphql/customer-account/CustomerDetailsQuery';
|
|
4
4
|
|
|
5
5
|
export function shouldRevalidate() {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {LoaderFunctionArgs} from 'react-router';
|
|
2
|
+
|
|
3
|
+
export async function action({params, context, request}: LoaderFunctionArgs) {
|
|
4
|
+
const response = await fetch(
|
|
5
|
+
`https://${context.env.PUBLIC_CHECKOUT_DOMAIN}/api/${params.version}/graphql.json`,
|
|
6
|
+
{
|
|
7
|
+
method: 'POST',
|
|
8
|
+
body: request.body,
|
|
9
|
+
headers: request.headers,
|
|
10
|
+
},
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
return new Response(response.body, {headers: new Headers(response.headers)});
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {useLoaderData, type MetaFunction} from '
|
|
2
|
+
import { useLoaderData, type MetaFunction } from 'react-router';
|
|
3
3
|
import {Image} from '@shopify/hydrogen';
|
|
4
4
|
import {redirectIfHandleIsLocalized} from '~/lib/redirect';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {Link, useLoaderData, type MetaFunction} from '
|
|
2
|
+
import { Link, useLoaderData, type MetaFunction } from 'react-router';
|
|
3
3
|
import {Image, getPaginationVariables} from '@shopify/hydrogen';
|
|
4
4
|
import type {ArticleItemFragment} from 'storefrontapi.generated';
|
|
5
5
|
import {PaginatedResourceSection} from '~/components/PaginatedResourceSection';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {Link, useLoaderData, type MetaFunction} from '
|
|
2
|
+
import { Link, useLoaderData, type MetaFunction } from 'react-router';
|
|
3
3
|
import {getPaginationVariables} from '@shopify/hydrogen';
|
|
4
4
|
import {PaginatedResourceSection} from '~/components/PaginatedResourceSection';
|
|
5
5
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {type MetaFunction, useLoaderData} from '
|
|
1
|
+
import { type MetaFunction, useLoaderData } from 'react-router';
|
|
2
2
|
import type {CartQueryDataReturn} from '@shopify/hydrogen';
|
|
3
3
|
import {CartForm} from '@shopify/hydrogen';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
data,
|
|
6
|
+
type LoaderFunctionArgs,
|
|
7
|
+
type ActionFunctionArgs,
|
|
8
|
+
type HeadersFunction,
|
|
9
|
+
} from '@shopify/remix-oxygen';
|
|
5
10
|
import {CartMain} from '~/components/CartMain';
|
|
6
11
|
|
|
7
12
|
export const meta: MetaFunction = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {redirect, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
2
|
-
import {useLoaderData, type MetaFunction} from '
|
|
2
|
+
import {useLoaderData, type MetaFunction} from 'react-router';
|
|
3
3
|
import {getPaginationVariables, Analytics} from '@shopify/hydrogen';
|
|
4
4
|
import {PaginatedResourceSection} from '~/components/PaginatedResourceSection';
|
|
5
5
|
import {redirectIfHandleIsLocalized} from '~/lib/redirect';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useLoaderData, Link} from '
|
|
1
|
+
import { useLoaderData, Link } from 'react-router';
|
|
2
2
|
import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
|
|
3
3
|
import {getPaginationVariables, Image} from '@shopify/hydrogen';
|
|
4
4
|
import type {CollectionFragment} from 'storefrontapi.generated';
|