@apollo/client 4.3.3 → 4.3.5
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 +30 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +4 -1
- package/__cjs/cache/core/types/Cache.d.cts +5 -0
- package/__cjs/cache/inmemory/entityStore.cjs +4 -4
- package/__cjs/cache/inmemory/helpers.cjs +5 -0
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +17 -6
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +3 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +15 -3
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +21 -5
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +2 -0
- package/__cjs/cache/inmemory/readFromStore.cjs +28 -10
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +7 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +32 -16
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +5 -2
- package/__cjs/core/ApolloClient.cjs +14 -14
- package/__cjs/core/ObservableQuery.cjs +8 -8
- package/__cjs/core/QueryInfo.cjs +22 -33
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +1 -1
- package/__cjs/core/QueryManager.cjs +22 -15
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/incremental/handlers/defer20220824.cjs +15 -2
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +5 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +58 -14
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +23 -12
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/types.d.cts +19 -1
- package/__cjs/invariantErrorCodes.cjs +64 -58
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +42 -43
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +0 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +4 -1
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +5 -0
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/inmemory/entityStore.js +4 -4
- package/cache/inmemory/helpers.js +5 -0
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +3 -1
- package/cache/inmemory/inMemoryCache.js +17 -6
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +15 -3
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +2 -0
- package/cache/inmemory/policies.js +22 -6
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +28 -10
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +7 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +5 -2
- package/cache/inmemory/writeToStore.js +33 -17
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.js +14 -14
- package/core/ObservableQuery.js +8 -8
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.js +23 -34
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +22 -15
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.js +3 -3
- package/incremental/handlers/defer20220824.d.ts +5 -1
- package/incremental/handlers/defer20220824.js +15 -2
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.d.ts +23 -12
- package/incremental/handlers/graphql17Alpha9.js +58 -14
- package/incremental/handlers/graphql17Alpha9.js.map +1 -1
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/types.d.ts +19 -1
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.js +64 -58
- package/package.json +1 -1
- package/react/hooks/useFragment.d.ts +42 -43
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks-compiled/useFragment.d.ts +42 -43
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/utilities/internal/index.d.ts +0 -1
- package/utilities/internal/index.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/utilities/internal/types/DeferInfo.cjs +0 -3
- package/__cjs/utilities/internal/types/DeferInfo.cjs.map +0 -1
- package/__cjs/utilities/internal/types/DeferInfo.d.cts +0 -10
- package/utilities/internal/types/DeferInfo.d.ts +0 -10
- package/utilities/internal/types/DeferInfo.js +0 -2
- package/utilities/internal/types/DeferInfo.js.map +0 -1
|
@@ -73,7 +73,8 @@ export class InMemoryCache extends ApolloCache {
|
|
|
73
73
|
// currently using a data store that can track cache dependencies.
|
|
74
74
|
const store = c.optimistic ? this.optimisticData : this.data;
|
|
75
75
|
if (supportsResultCaching(store)) {
|
|
76
|
-
const { optimistic, id
|
|
76
|
+
const { optimistic, id } = c;
|
|
77
|
+
const variables = this.serializeVariables(c.query, c.variables);
|
|
77
78
|
return store.makeCacheKey(c.query,
|
|
78
79
|
// Different watches can have the same query, optimistic
|
|
79
80
|
// status, rootId, and variables, but if their callbacks are
|
|
@@ -129,7 +130,7 @@ export class InMemoryCache extends ApolloCache {
|
|
|
129
130
|
return this.serializeInputArray(value, variableTypes, match[1], coordinate);
|
|
130
131
|
}
|
|
131
132
|
else if (__DEV__) {
|
|
132
|
-
__DEV__ && invariant.warn(
|
|
133
|
+
__DEV__ && invariant.warn(113, coordinate, scalarType, unwrapScalarType(scalarType));
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
const scalar = this.getScalar(unwrapScalarType(scalarType));
|
|
@@ -271,10 +272,7 @@ export class InMemoryCache extends ApolloCache {
|
|
|
271
272
|
recallCache(this);
|
|
272
273
|
}
|
|
273
274
|
this.watches.add(watch);
|
|
274
|
-
|
|
275
|
-
this.maybeBroadcastWatch(watch);
|
|
276
|
-
}
|
|
277
|
-
return () => {
|
|
275
|
+
const removeWatch = () => {
|
|
278
276
|
// Once we remove the last watch from this.watches, cache.broadcastWatches
|
|
279
277
|
// no longer does anything, so we preemptively tell the reactive variable
|
|
280
278
|
// system to exclude this cache from future broadcasts.
|
|
@@ -286,6 +284,19 @@ export class InMemoryCache extends ApolloCache {
|
|
|
286
284
|
// leaks involving the closure of watch.callback.
|
|
287
285
|
this.maybeBroadcastWatch.forget(watch);
|
|
288
286
|
};
|
|
287
|
+
if (watch.immediate) {
|
|
288
|
+
try {
|
|
289
|
+
this.maybeBroadcastWatch(watch);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
// The caller never receives removeWatch when this throws, so without
|
|
293
|
+
// this the watch would stay registered with nothing able to remove it,
|
|
294
|
+
// and every later broadcast would run into the same failing read.
|
|
295
|
+
removeWatch();
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return removeWatch;
|
|
289
300
|
}
|
|
290
301
|
gc(options) {
|
|
291
302
|
canonicalStringify.reset();
|