@graphcommerce/ecommerce-ui 10.1.0-canary.34 → 10.1.0-canary.36
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @graphcommerce/ecommerce-ui
|
|
2
2
|
|
|
3
|
+
## 10.1.0-canary.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2645](https://github.com/graphcommerce-org/graphcommerce/pull/2645) [`08636cd`](https://github.com/graphcommerce-org/graphcommerce/commit/08636cd694f64a8a4bd950d537efbf5483e56927) - Fix Preview Mode causing an infinite reload loop in production
|
|
8
|
+
|
|
9
|
+
When enabling Preview Mode in production the `secret` has to be typed (it is only pre-filled in development), which marks the field dirty and persists it to `sessionStorage` via `FormPersist`. On the next render `PreviewModeEnabled` restored that persisted `secret` with `setValue(…, { shouldDirty: true })`, which the all-fields `FormAutoSubmit` interpreted as a user change and submitted the `update` action — a `window.location` navigation to `/api/preview` that redirects back with a `307`, re-triggering the restore and reload endlessly.
|
|
10
|
+
|
|
11
|
+
`FormAutoSubmit` now watches only `previewData` (the field the toolbar actually edits), and the preview `secret` is excluded from `FormPersist` so the token is no longer stored in the browser. ([@paales](https://github.com/paales))
|
|
12
|
+
|
|
13
|
+
## 10.1.0-canary.35
|
|
14
|
+
|
|
3
15
|
## 10.1.0-canary.34
|
|
4
16
|
|
|
5
17
|
## 10.1.0-canary.33
|
|
@@ -50,7 +50,7 @@ export function PreviewModeDisabled() {
|
|
|
50
50
|
<TextFieldElement control={form.control} name='secret' label='Secret' />
|
|
51
51
|
</Box>
|
|
52
52
|
</MessageSnackbar>
|
|
53
|
-
<FormPersist form={form} name='PreviewModePreviewData' />
|
|
53
|
+
<FormPersist form={form} name='PreviewModePreviewData' exclude={['secret']} />
|
|
54
54
|
</FormProvider>
|
|
55
55
|
)
|
|
56
56
|
}
|
|
@@ -91,8 +91,13 @@ export function PreviewModeEnabled() {
|
|
|
91
91
|
<PreviewModeToolbar />
|
|
92
92
|
</Box>
|
|
93
93
|
</MessageSnackbar>
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
{/* Exclude `secret` from persistence: it is only relevant to the `enable` action and storing
|
|
95
|
+
the preview token in the browser is a needless secret leak. */}
|
|
96
|
+
<FormPersist form={form} name='PreviewModePreviewData' exclude={['secret']} />
|
|
97
|
+
{/* Only auto-submit on `previewData` edits. Watching every field made the restore of a
|
|
98
|
+
persisted `secret` (via `setValue(shouldDirty)`) look like a user change, which fired the
|
|
99
|
+
`update` submit → 307 redirect → reload → restore → … infinite loop in production. */}
|
|
100
|
+
<FormAutoSubmit control={form.control} name={['previewData']} submit={submit} />
|
|
96
101
|
</FormProvider>
|
|
97
102
|
)
|
|
98
103
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/ecommerce-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "10.1.0-canary.
|
|
5
|
+
"version": "10.1.0-canary.36",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^10.1.0-canary.
|
|
16
|
-
"@graphcommerce/graphql": "^10.1.0-canary.
|
|
17
|
-
"@graphcommerce/next-ui": "^10.1.0-canary.
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.
|
|
19
|
-
"@graphcommerce/react-hook-form": "^10.1.0-canary.
|
|
20
|
-
"@graphcommerce/typescript-config-pwa": "^10.1.0-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^10.1.0-canary.36",
|
|
16
|
+
"@graphcommerce/graphql": "^10.1.0-canary.36",
|
|
17
|
+
"@graphcommerce/next-ui": "^10.1.0-canary.36",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.36",
|
|
19
|
+
"@graphcommerce/react-hook-form": "^10.1.0-canary.36",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "^10.1.0-canary.36",
|
|
21
21
|
"@lingui/core": "^5",
|
|
22
22
|
"@lingui/macro": "^5",
|
|
23
23
|
"@lingui/react": "^5",
|