@faststore/core 4.0.1-dev.1 → 4.0.1-dev.2
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.0.1-dev.
|
|
2
|
+
> @faststore/core@4.0.1-dev.1 generate /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> pnpm run gen-types && pnpm run cache-graphql
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @faststore/core@4.0.1-dev.
|
|
6
|
+
> @faststore/core@4.0.1-dev.1 gen-types /home/runner/work/faststore/faststore/packages/core
|
|
7
7
|
> node ../cli/bin/run generate-types .
|
|
8
8
|
|
|
9
9
|
[33m[STARTED][39m Parse Configuration
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
[32m[COMPLETED][39m Generate to /home/runner/work/faststore/faststore/packages/core/@generated/
|
|
20
20
|
[32m[COMPLETED][39m Generate outputs
|
|
21
21
|
|
|
22
|
-
> @faststore/core@4.0.1-dev.
|
|
22
|
+
> @faststore/core@4.0.1-dev.1 cache-graphql /home/runner/work/faststore/faststore/packages/core
|
|
23
23
|
> node ../cli/bin/run cache-graphql --config=./discovery.config.default.js --queries=./@generated/persisted-documents.json
|
|
24
24
|
|
|
25
25
|
[Info] - Config file location: /home/runner/work/faststore/faststore/packages/core/discovery.config.default.js
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.0.1-dev.
|
|
2
|
+
> @faststore/core@4.0.1-dev.1 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[1m[46m RUN [49m[22m [36mv4.0.7 [39m[90m/home/runner/work/faststore/faststore/packages/core[39m
|
|
7
7
|
|
|
8
8
|
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
9
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m
|
|
10
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
9
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m 122[2mms[22m[39m
|
|
10
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 37[2mms[22m[39m
|
|
11
11
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
12
12
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
13
13
|
at validateCart [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/index.ts:119:27[90m)[39m
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:342:23)
|
|
16
16
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
17
17
|
|
|
18
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 40[2mms[22m[39m
|
|
18
19
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
19
20
|
[22m[39mError in optimistic validation: ReferenceError: Cannot access '__vite_ssr_import_4__' before initialization
|
|
20
21
|
at getSettings [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/localization/useLocalizationConfig.tsx:126:45[90m)[39m
|
|
@@ -23,25 +24,24 @@
|
|
|
23
24
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:342:23)
|
|
24
25
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
25
26
|
|
|
26
|
-
[32m✓[39m [30m[
|
|
27
|
-
[32m✓[39m [30m[
|
|
28
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m
|
|
29
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
30
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
31
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
32
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
33
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
34
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
35
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
36
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
37
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
38
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/
|
|
39
|
-
|
|
40
|
-
[33m[2m✓[22m[39m should
|
|
41
|
-
[33m[2m✓[22m[39m should handle options and execute [33m 326[2mms[22m[39m
|
|
27
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
28
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 22[2mms[22m[39m
|
|
29
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 92[2mms[22m[39m
|
|
30
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
31
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/clearCookies.test.ts [2m([22m[2m20 tests[22m[2m)[22m[32m 79[2mms[22m[39m
|
|
32
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/content/service.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
33
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
34
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getRequestHostname.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
35
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/store-url.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
36
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/validateSessionRefreshToken.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
37
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/preview.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 24[2mms[22m[39m
|
|
38
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/index.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
39
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 1259[2mms[22m[39m
|
|
40
|
+
[33m[2m✓[22m[39m should return a valid merged GraphQL schema [33m 599[2mms[22m[39m
|
|
41
|
+
[33m[2m✓[22m[39m should exist with its plugins [33m 406[2mms[22m[39m
|
|
42
42
|
|
|
43
43
|
[2m Test Files [22m [1m[32m17 passed[39m[22m[90m (17)[39m
|
|
44
44
|
[2m Tests [22m [1m[32m203 passed[39m[22m[90m (203)[39m
|
|
45
|
-
[2m Start at [22m
|
|
46
|
-
[2m Duration [22m 13.
|
|
45
|
+
[2m Start at [22m 15:30:48
|
|
46
|
+
[2m Duration [22m 13.81s[2m (transform 5.83s, setup 0ms, collect 16.52s, tests 1.83s, environment 9.75s, prepare 663ms)[22m
|
|
47
47
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.1-dev.2](https://github.com/vtex/faststore/compare/v4.0.1-dev.1...v4.0.1-dev.2) (2026-05-11)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- localization selector stale and reset selection for unsaved changes ([#3301](https://github.com/vtex/faststore/issues/3301)) ([023e52e](https://github.com/vtex/faststore/commit/023e52ee3c8798cfc9f12ed98e99e8efacb1f1d5))
|
|
11
|
+
|
|
6
12
|
## [4.0.1-dev.1](https://github.com/vtex/faststore/compare/v4.0.1-dev.0...v4.0.1-dev.1) (2026-05-07)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "4.0.1-dev.
|
|
3
|
+
"version": "4.0.1-dev.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"@envelop/graphql-jit": "catalog:",
|
|
40
40
|
"@envelop/parser-cache": "catalog:",
|
|
41
41
|
"@envelop/validation-cache": "catalog:",
|
|
42
|
-
"@faststore/api": "4.0.1-dev.
|
|
43
|
-
"@faststore/diagnostics": "4.0.1-dev.
|
|
44
|
-
"@faststore/lighthouse": "4.0.1-dev.
|
|
45
|
-
"@faststore/sdk": "4.0.1-dev.
|
|
46
|
-
"@faststore/ui": "4.0.1-dev.
|
|
42
|
+
"@faststore/api": "4.0.1-dev.2",
|
|
43
|
+
"@faststore/diagnostics": "4.0.1-dev.2",
|
|
44
|
+
"@faststore/lighthouse": "4.0.1-dev.2",
|
|
45
|
+
"@faststore/sdk": "4.0.1-dev.2",
|
|
46
|
+
"@faststore/ui": "4.0.1-dev.2",
|
|
47
47
|
"@graphql-codegen/cli": "catalog:",
|
|
48
48
|
"@graphql-codegen/client-preset": "4.2.6",
|
|
49
49
|
"@graphql-codegen/typescript": "catalog:",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"react": "catalog:",
|
|
114
114
|
"react-dom": "catalog:"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "78469e62248563c911ba449ea69fc1edacf7277e"
|
|
117
117
|
}
|
|
@@ -49,6 +49,7 @@ const LocalizationButton = ({
|
|
|
49
49
|
setLocaleCode,
|
|
50
50
|
setCurrencyCode,
|
|
51
51
|
save,
|
|
52
|
+
reset,
|
|
52
53
|
isSaveEnabled,
|
|
53
54
|
error,
|
|
54
55
|
} = useBindingSelector()
|
|
@@ -97,7 +98,10 @@ const LocalizationButton = ({
|
|
|
97
98
|
{isSelectorOpen && (
|
|
98
99
|
<LocalizationSelector
|
|
99
100
|
isOpen={isSelectorOpen}
|
|
100
|
-
onClose={() =>
|
|
101
|
+
onClose={() => {
|
|
102
|
+
setIsSelectorOpen(false)
|
|
103
|
+
reset()
|
|
104
|
+
}}
|
|
101
105
|
triggerRef={buttonRef}
|
|
102
106
|
languages={languages}
|
|
103
107
|
currencies={currencies}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'react'
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
import storeConfig from '../../../discovery.config'
|
|
4
4
|
import { buildRedirectUrl } from '../../utils/localization/bindingPaths'
|
|
@@ -56,6 +56,8 @@ export interface UseBindingSelectorReturn {
|
|
|
56
56
|
setCurrencyCode: (code: string) => void
|
|
57
57
|
/** Action to save selections and redirect */
|
|
58
58
|
save: () => void
|
|
59
|
+
/** Discards unsaved changes and resets selections to current session values */
|
|
60
|
+
reset: () => void
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
/**
|
|
@@ -77,6 +79,23 @@ export function useBindingSelector(): UseBindingSelectorReturn {
|
|
|
77
79
|
)
|
|
78
80
|
const [error, setError] = useState<BindingSelectorError | null>(null)
|
|
79
81
|
|
|
82
|
+
const hasUserEditedSelection = useRef(false)
|
|
83
|
+
|
|
84
|
+
// Sync selections when session resolves after initial render (e.g. stale session
|
|
85
|
+
// from a previous locale when navigating between locale-prefixed paths).
|
|
86
|
+
// Skipped once the user has made an in-progress selection; call reset() on close to re-enable.
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!hasUserEditedSelection.current) {
|
|
89
|
+
setLocaleCode(currentLocale ?? null)
|
|
90
|
+
}
|
|
91
|
+
}, [currentLocale])
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!hasUserEditedSelection.current) {
|
|
95
|
+
setCurrencyCode(currentCurrency?.code ?? null)
|
|
96
|
+
}
|
|
97
|
+
}, [currentCurrency?.code])
|
|
98
|
+
|
|
80
99
|
// Build language options with disambiguation - returns Record<localeCode, languageName>
|
|
81
100
|
const languages = useMemo(
|
|
82
101
|
() => buildLanguageOptions(localizationConfig.locales),
|
|
@@ -98,6 +117,7 @@ export function useBindingSelector(): UseBindingSelectorReturn {
|
|
|
98
117
|
// Handle locale code change
|
|
99
118
|
const handleSetLocaleCode = useCallback(
|
|
100
119
|
(code: string) => {
|
|
120
|
+
hasUserEditedSelection.current = true
|
|
101
121
|
setLocaleCode(code)
|
|
102
122
|
setError(null)
|
|
103
123
|
|
|
@@ -126,6 +146,7 @@ export function useBindingSelector(): UseBindingSelectorReturn {
|
|
|
126
146
|
|
|
127
147
|
// Handle currency code change
|
|
128
148
|
const handleSetCurrencyCode = useCallback((code: string) => {
|
|
149
|
+
hasUserEditedSelection.current = true
|
|
129
150
|
setCurrencyCode(code)
|
|
130
151
|
setError(null)
|
|
131
152
|
}, [])
|
|
@@ -169,6 +190,14 @@ export function useBindingSelector(): UseBindingSelectorReturn {
|
|
|
169
190
|
|
|
170
191
|
const isSaveEnabled = Boolean(localeCode && currencyCode && !error)
|
|
171
192
|
|
|
193
|
+
// Discards unsaved changes and re-enables session syncing
|
|
194
|
+
const reset = useCallback(() => {
|
|
195
|
+
hasUserEditedSelection.current = false
|
|
196
|
+
setLocaleCode(currentLocale ?? null)
|
|
197
|
+
setCurrencyCode(currentCurrency?.code ?? null)
|
|
198
|
+
setError(null)
|
|
199
|
+
}, [currentLocale, currentCurrency?.code])
|
|
200
|
+
|
|
172
201
|
return {
|
|
173
202
|
languages,
|
|
174
203
|
currencies,
|
|
@@ -179,5 +208,6 @@ export function useBindingSelector(): UseBindingSelectorReturn {
|
|
|
179
208
|
setLocaleCode: handleSetLocaleCode,
|
|
180
209
|
setCurrencyCode: handleSetCurrencyCode,
|
|
181
210
|
save,
|
|
211
|
+
reset,
|
|
182
212
|
}
|
|
183
213
|
}
|