@graphcommerce/graphql 5.2.0-canary.6 → 5.2.0-canary.7
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 +6 -0
- package/createCacheReviver.ts +7 -7
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 5.2.0-canary.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1749](https://github.com/graphcommerce-org/graphcommerce/pull/1749) [`16e91da42`](https://github.com/graphcommerce-org/graphcommerce/commit/16e91da42dcb454ea4761d1780b9338c88ef1463) - Fix spelling error incomming to incoming ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
3
9
|
## 5.2.0-canary.6
|
|
4
10
|
|
|
5
11
|
## 5.2.0-canary.5
|
package/createCacheReviver.ts
CHANGED
|
@@ -15,9 +15,9 @@ export async function createCacheReviver(
|
|
|
15
15
|
createCache: () => ApolloCache<NormalizedCacheObject>,
|
|
16
16
|
policies: StrictTypedTypePolicies[],
|
|
17
17
|
migrations: MigrateCache[],
|
|
18
|
-
|
|
18
|
+
incomingState: NormalizedCacheObject = {},
|
|
19
19
|
) {
|
|
20
|
-
let state =
|
|
20
|
+
let state = incomingState
|
|
21
21
|
const typePoliciesVersion = getTypePoliciesVersion(policies)
|
|
22
22
|
|
|
23
23
|
if (typeof window !== 'undefined') {
|
|
@@ -34,12 +34,12 @@ export async function createCacheReviver(
|
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
client.onClearStore(async () => {
|
|
37
|
-
client.cache.restore(
|
|
37
|
+
client.cache.restore(incomingState)
|
|
38
38
|
await persistor?.persist()
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
client.onResetStore(async () => {
|
|
42
|
-
client.cache.restore(
|
|
42
|
+
client.cache.restore(incomingState)
|
|
43
43
|
await persistor?.persist()
|
|
44
44
|
})
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ export async function createCacheReviver(
|
|
|
47
47
|
const currentVersion = window.localStorage[APOLLO_CACHE_VERSION] as string | undefined
|
|
48
48
|
|
|
49
49
|
if (currentVersion === typePoliciesVersion && storedState) {
|
|
50
|
-
state = mergeDeep(JSON.parse(storedState),
|
|
50
|
+
state = mergeDeep(JSON.parse(storedState), incomingState)
|
|
51
51
|
} else if (storedState) {
|
|
52
52
|
console.info(
|
|
53
53
|
'[@graphcommerce/graphql] migrating apollo cache, detected a typePolicy change',
|
|
@@ -59,13 +59,13 @@ export async function createCacheReviver(
|
|
|
59
59
|
// Run the migration
|
|
60
60
|
migrateCacheHandler(oldCache, cache, migrations)
|
|
61
61
|
|
|
62
|
-
state = mergeDeep(cache.extract(),
|
|
62
|
+
state = mergeDeep(cache.extract(), incomingState)
|
|
63
63
|
console.info('migration complete')
|
|
64
64
|
} catch (e) {
|
|
65
65
|
console.info('migration error (starting with a clean state):', e)
|
|
66
66
|
|
|
67
67
|
// couldn't be upgraded
|
|
68
|
-
state =
|
|
68
|
+
state = incomingState
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
window.localStorage[APOLLO_CACHE_VERSION] = typePoliciesVersion
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/graphql",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "5.2.0-canary.
|
|
5
|
+
"version": "5.2.0-canary.7",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@apollo/client": "^3.7.2",
|
|
17
|
-
"@graphcommerce/graphql-codegen-near-operation-file": "5.2.0-canary.
|
|
18
|
-
"@graphcommerce/graphql-codegen-relay-optimizer-plugin": "5.2.0-canary.
|
|
17
|
+
"@graphcommerce/graphql-codegen-near-operation-file": "5.2.0-canary.7",
|
|
18
|
+
"@graphcommerce/graphql-codegen-relay-optimizer-plugin": "5.2.0-canary.7",
|
|
19
19
|
"@graphql-codegen/add": "3.2.3",
|
|
20
20
|
"@graphql-codegen/fragment-matcher": "3.3.3",
|
|
21
21
|
"@graphql-codegen/introspection": "2.2.3",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"graphql": "16.6.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@graphcommerce/eslint-config-pwa": "5.2.0-canary.
|
|
33
|
-
"@graphcommerce/prettier-config-pwa": "5.2.0-canary.
|
|
34
|
-
"@graphcommerce/typescript-config-pwa": "5.2.0-canary.
|
|
32
|
+
"@graphcommerce/eslint-config-pwa": "5.2.0-canary.7",
|
|
33
|
+
"@graphcommerce/prettier-config-pwa": "5.2.0-canary.7",
|
|
34
|
+
"@graphcommerce/typescript-config-pwa": "5.2.0-canary.7"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": "^18.2.0",
|