@apollo/client
Advanced tools
@@ -150,3 +150,3 @@ "use strict";; | ||
| if (id === undefined) { | ||
| __DEV__ && invariant_1.invariant.warn(121, actualFragmentName); | ||
| __DEV__ && invariant_1.invariant.warn(122, actualFragmentName); | ||
| } | ||
@@ -153,0 +153,0 @@ } |
@@ -85,3 +85,3 @@ "use strict";; | ||
| return; | ||
| (0, invariant_1.invariant)(typeof dataId === "string", 105); | ||
| (0, invariant_1.invariant)(typeof dataId === "string", 106); | ||
| // Parse all scalars before merging so that the storeObjectReconciler can | ||
@@ -193,3 +193,3 @@ // deep compare the parsed value with the existing value | ||
| if (this.lookup(ref.__ref) === undefined) { | ||
| __DEV__ && invariant_1.invariant.warn(106, ref); | ||
| __DEV__ && invariant_1.invariant.warn(107, ref); | ||
| return true; | ||
@@ -223,3 +223,3 @@ } | ||
| if (seenReference && someNonReference !== undefined) { | ||
| __DEV__ && invariant_1.invariant.warn(107, someNonReference); | ||
| __DEV__ && invariant_1.invariant.warn(108, someNonReference); | ||
| break; | ||
@@ -226,0 +226,0 @@ } |
@@ -44,3 +44,3 @@ "use strict"; | ||
| } | ||
| (0, invariant_1.invariant)(extracted !== void 0, 108, schemaKeyPath.join("."), object); | ||
| (0, invariant_1.invariant)(extracted !== void 0, 109, schemaKeyPath.join("."), object); | ||
| return extracted; | ||
@@ -47,0 +47,0 @@ })); |
@@ -254,3 +254,3 @@ "use strict";; | ||
| if (typename !== old) { | ||
| (0, invariant_1.invariant)(!old || old === which, 109, which); | ||
| (0, invariant_1.invariant)(!old || old === which, 110, which); | ||
| // First, delete any old __typename associated with this rootId from | ||
@@ -398,3 +398,3 @@ // rootIdsByTypename. | ||
| if (checkingFuzzySubtypes) { | ||
| __DEV__ && invariant_1.invariant.warn(110, typename, supertype); | ||
| __DEV__ && invariant_1.invariant.warn(111, typename, supertype); | ||
| } | ||
@@ -656,3 +656,3 @@ // Record positive results for faster future lookup. | ||
| if (environment_1.__DEV__ && options.from === void 0) { | ||
| __DEV__ && invariant_1.invariant.warn(111, (0, internal_2.stringifyForDisplay)(Array.from(readFieldArgs))); | ||
| __DEV__ && invariant_1.invariant.warn(112, (0, internal_2.stringifyForDisplay)(Array.from(readFieldArgs))); | ||
| } | ||
@@ -667,3 +667,3 @@ if (void 0 === options.variables) { | ||
| if ((0, internal_2.isArray)(existing) || (0, internal_2.isArray)(incoming)) { | ||
| throw (0, invariant_1.newInvariantError)(112); | ||
| throw (0, invariant_1.newInvariantError)(113); | ||
| } | ||
@@ -705,4 +705,4 @@ // These dynamic checks are necessary because the parameters of a | ||
| function warnAboutScalarConfig(typename, fieldName, scalar, kind) { | ||
| __DEV__ && invariant_1.invariant.warn(113, `${typename}.${fieldName}`, scalar, kind); | ||
| __DEV__ && invariant_1.invariant.warn(114, `${typename}.${fieldName}`, scalar, kind); | ||
| } | ||
| //# sourceMappingURL=policies.cjs.map |
@@ -292,3 +292,3 @@ "use strict";; | ||
| if (policy?.scalar) { | ||
| __DEV__ && invariant_1.invariant.warn(114, `${typename}.${fieldName}`, policy.scalar); | ||
| __DEV__ && invariant_1.invariant.warn(115, `${typename}.${fieldName}`, policy.scalar); | ||
| } | ||
@@ -330,3 +330,3 @@ } | ||
| if (!fragment && selection.kind === graphql_1.Kind.FRAGMENT_SPREAD) { | ||
| throw (0, invariant_1.newInvariantError)(115, selection.name.value); | ||
| throw (0, invariant_1.newInvariantError)(116, selection.name.value); | ||
| } | ||
@@ -629,3 +629,3 @@ if (fragment && policies.fragmentMatches(fragment, typename)) { | ||
| !(0, utilities_1.isReference)(value), | ||
| 116, | ||
| 117, | ||
| (0, helpers_js_1.getTypenameFromStoreObject)(store, value), | ||
@@ -632,0 +632,0 @@ field.name.value |
@@ -78,3 +78,3 @@ "use strict";; | ||
| if (!(0, utilities_1.isReference)(ref)) { | ||
| throw (0, invariant_1.newInvariantError)(117, result); | ||
| throw (0, invariant_1.newInvariantError)(118, result); | ||
| } | ||
@@ -241,3 +241,3 @@ // So far, the store has not been modified, so now it's time to process | ||
| !policies.getReadFunction(typename, field.name.value)) { | ||
| invariant_1.invariant.error(118, (0, internal_1.resultKeyNameFromField)(field), result); | ||
| invariant_1.invariant.error(119, (0, internal_1.resultKeyNameFromField)(field), result); | ||
| } | ||
@@ -390,3 +390,3 @@ }); | ||
| if (!fragment && selection.kind === graphql_1.Kind.FRAGMENT_SPREAD) { | ||
| throw (0, invariant_1.newInvariantError)(119, selection.name.value); | ||
| throw (0, invariant_1.newInvariantError)(120, selection.name.value); | ||
| } | ||
@@ -564,3 +564,3 @@ if (fragment && | ||
| } | ||
| __DEV__ && invariant_1.invariant.warn(120, fieldName, parentType, childTypenames.length ? | ||
| __DEV__ && invariant_1.invariant.warn(121, fieldName, parentType, childTypenames.length ? | ||
| "either ensure all objects of type " + | ||
@@ -567,0 +567,0 @@ childTypenames.join(" and ") + |
@@ -281,8 +281,4 @@ import type { DocumentNode } from "graphql"; | ||
| private variablesUnknown; | ||
| /** | ||
| * @internal will be read and written from `QueryInfo` | ||
| * | ||
| * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. | ||
| */ | ||
| _lastWrite?: unknown; | ||
| private didWarnOnFeud; | ||
| private lastMissing?; | ||
| get query(): TypedDocumentNode<TData, TVariables>; | ||
@@ -473,2 +469,3 @@ /** | ||
| notify(scheduled?: boolean): void; | ||
| private deliverCacheDiff; | ||
| private activeOperations; | ||
@@ -475,0 +472,0 @@ private pushOperation; |
+11
-125
@@ -8,3 +8,2 @@ "use strict";; | ||
| exports.QueryInfo = void 0; | ||
| const equality_1 = require("@wry/equality"); | ||
| const trie_1 = require("@wry/trie"); | ||
@@ -16,19 +15,2 @@ const environment_1 = require("@apollo/client/utilities/environment"); | ||
| const IGNORE = {}; | ||
| const destructiveMethodCounts = new WeakMap(); | ||
| function wrapDestructiveCacheMethod(cache, methodName) { | ||
| const original = cache[methodName]; | ||
| if (typeof original === "function") { | ||
| // @ts-expect-error this is just too generic to be typed correctly | ||
| cache[methodName] = function () { | ||
| destructiveMethodCounts.set(cache, | ||
| // The %1e15 allows the count to wrap around to 0 safely every | ||
| // quadrillion evictions, so there's no risk of overflow. To be | ||
| // clear, this is more of a pedantic principle than something | ||
| // that matters in any conceivable practical scenario. | ||
| (destructiveMethodCounts.get(cache) + 1) % 1e15); | ||
| // @ts-expect-error this is just too generic to be typed correctly | ||
| return original.apply(this, arguments); | ||
| }; | ||
| } | ||
| } | ||
| const queryInfoIds = new WeakMap(); | ||
@@ -47,3 +29,3 @@ // A QueryInfo object represents a single network request, either initiated | ||
| constructor(queryManager, observableQuery) { | ||
| const cache = (this.cache = queryManager.cache); | ||
| this.cache = queryManager.cache; | ||
| const id = (queryInfoIds.get(queryManager) || 0) + 1; | ||
@@ -54,51 +36,3 @@ queryInfoIds.set(queryManager, id); | ||
| this.queryManager = queryManager; | ||
| // Track how often cache.evict is called, since we want eviction to | ||
| // override the write-skipping logic in `shouldWrite`, by causing it to | ||
| // return true. Wrapping the cache.evict method is a bit of a hack, but it | ||
| // saves us from having to make eviction counting an official part of the | ||
| // ApolloCache API. | ||
| if (!destructiveMethodCounts.has(cache)) { | ||
| destructiveMethodCounts.set(cache, 0); | ||
| wrapDestructiveCacheMethod(cache, "evict"); | ||
| wrapDestructiveCacheMethod(cache, "modify"); | ||
| wrapDestructiveCacheMethod(cache, "reset"); | ||
| } | ||
| } | ||
| /** | ||
| * @internal | ||
| * Tracks the last result written to the cache so that `shouldWrite` can skip | ||
| * an identical write. Since a `QueryInfo` only ever represents a single | ||
| * network request, this is shared by all `QueryInfo` instances of an | ||
| * `ObservableQuery`. A standalone `QueryInfo` keeps a local version. | ||
| * | ||
| * A network result that was explicitly asked for always takes precedence over | ||
| * what is already cached, so `ObservableQuery.refetch` and polling clear this | ||
| * value before starting their request. | ||
| * | ||
| * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. | ||
| */ | ||
| _lastWrite; | ||
| get lastWrite() { | ||
| return (this.observableQuery || this)._lastWrite; | ||
| } | ||
| set lastWrite(value) { | ||
| (this.observableQuery || this)._lastWrite = value; | ||
| } | ||
| resetLastWrite() { | ||
| this.lastWrite = void 0; | ||
| } | ||
| shouldWrite(result, variables) { | ||
| const { lastWrite } = this; | ||
| return (!lastWrite || | ||
| // If cache.evict has been called since the last time we wrote this | ||
| // data into the cache, there's a chance writing this result into | ||
| // the cache will repair what was evicted. | ||
| lastWrite.dmCount !== destructiveMethodCounts.get(this.cache) || | ||
| !(0, equality_1.equal)(variables, lastWrite.variables) || | ||
| !(0, equality_1.equal)(result.data, lastWrite.result.data) || | ||
| // We have to compare these values because its possible the final chunk | ||
| // emitted in the incremental result is just `hasNext: false`. This | ||
| // ensures we trigger a cache write when we get `isLastChunk: true`. | ||
| lastWrite.hasNext !== this.hasNext); | ||
| } | ||
| get hasNext() { | ||
@@ -169,10 +103,5 @@ return this.incremental ? this.incremental.hasNext : false; | ||
| } | ||
| if (skipCache) { | ||
| if (skipCache || !shouldWriteResult(result, errorPolicy)) { | ||
| return result; | ||
| } | ||
| if (!shouldWriteResult(result, errorPolicy)) { | ||
| this.lastWrite = void 0; | ||
| return result; | ||
| } | ||
| let written = false; | ||
| // Using a transaction here so we have a chance to read the result | ||
@@ -193,51 +122,9 @@ // back from the cache before the watch callback fires as a result | ||
| update: (cache) => { | ||
| const shouldWrite = this.shouldWrite(result, variables); | ||
| // If result is the same as the last result we received from | ||
| // the network (and the variables match too), avoid writing | ||
| // result into the cache again. The wisdom of skipping this | ||
| // cache write is far from obvious, since any cache write | ||
| // could be the one that puts the cache back into a desired | ||
| // state, fixing corruption or missing data. However, if we | ||
| // always write every network result into the cache, we enable | ||
| // feuds between queries competing to update the same data in | ||
| // incompatible ways, which can lead to an endless cycle of | ||
| // cache broadcasts and useless network requests. As with any | ||
| // feud, eventually one side must step back from the brink, | ||
| // letting the other side(s) have the last word(s). There may | ||
| // be other points where we could break this cycle, such as | ||
| // silencing the broadcast for cache.writeQuery (not a good | ||
| // idea, since it just delays the feud a bit) or somehow | ||
| // avoiding the network request that just happened (also bad, | ||
| // because the server could return useful new data). All | ||
| // options considered, skipping this cache write seems to be | ||
| // the least damaging place to break the cycle, because it | ||
| // reflects the intuition that we recently wrote this exact | ||
| // result into the cache, so the cache *should* already/still | ||
| // contain this data. If some other query has clobbered that | ||
| // data in the meantime, that's too bad, but there will be no | ||
| // winners if every query blindly reverts to its own version | ||
| // of the data. This approach also gives the network a chance | ||
| // to return new data, which will be written into the cache as | ||
| // usual, notifying only those queries that are directly | ||
| // affected by the cache updates, as usual. In the future, an | ||
| // even more sophisticated cache could perhaps prevent or | ||
| // mitigate the clobbering somehow, but that would make this | ||
| // particular cache write even less important, and thus | ||
| // skipping it would be even safer than it is today. | ||
| if (shouldWrite) { | ||
| cache.writeQuery({ | ||
| query, | ||
| data: result.data, | ||
| variables, | ||
| overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */, | ||
| extensions: result.extensions, | ||
| }); | ||
| this.lastWrite = { | ||
| result, | ||
| variables, | ||
| dmCount: destructiveMethodCounts.get(this.cache), | ||
| hasNext: this.hasNext, | ||
| }; | ||
| written = true; | ||
| } | ||
| cache.writeQuery({ | ||
| query, | ||
| data: result.data, | ||
| variables, | ||
| overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */, | ||
| extensions: result.extensions, | ||
| }); | ||
| const { dataState, result: diffResult } = this.getDiff({ | ||
@@ -252,7 +139,6 @@ ...diffOptions, | ||
| dataState === "streaming" || | ||
| (returnPartialData && dataState === "partial" && shouldWrite)) { | ||
| (returnPartialData && dataState === "partial")) { | ||
| result = { ...result, data: diffResult, dataState }; | ||
| } | ||
| else if (environment_1.__DEV__ && | ||
| written && | ||
| // A result that is still streaming is expected to read back | ||
@@ -495,3 +381,3 @@ // incomplete until the remaining chunks arrive. | ||
| __DEV__ && invariant_1.invariant.warn( | ||
| 89, | ||
| 90, | ||
| (0, internal_1.getOperationName)(query, "(anonymous)"), | ||
@@ -498,0 +384,0 @@ diff.missing?.missing, |
@@ -19,8 +19,2 @@ import type { DocumentNode, FormattedExecutionResult } from "graphql"; | ||
| } | ||
| interface LastWrite { | ||
| result: FormattedExecutionResult<any, ExtensionsWithStreamInfo>; | ||
| variables: ApolloClient.WatchQueryOptions["variables"]; | ||
| dmCount: number | undefined; | ||
| hasNext: boolean; | ||
| } | ||
| interface OperationInfo<TData, TVariables extends OperationVariables, AllowedCacheWriteBehavior = CacheWriteBehavior> { | ||
@@ -43,20 +37,2 @@ document: DocumentNode | TypedDocumentNode<TData, TVariables>; | ||
| constructor(queryManager: QueryManager, observableQuery?: ObservableQuery<any, any>); | ||
| /** | ||
| * @internal | ||
| * Tracks the last result written to the cache so that `shouldWrite` can skip | ||
| * an identical write. Since a `QueryInfo` only ever represents a single | ||
| * network request, this is shared by all `QueryInfo` instances of an | ||
| * `ObservableQuery`. A standalone `QueryInfo` keeps a local version. | ||
| * | ||
| * A network result that was explicitly asked for always takes precedence over | ||
| * what is already cached, so `ObservableQuery.refetch` and polling clear this | ||
| * value before starting their request. | ||
| * | ||
| * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. | ||
| */ | ||
| _lastWrite?: LastWrite; | ||
| private get lastWrite(); | ||
| private set lastWrite(value); | ||
| resetLastWrite(): void; | ||
| private shouldWrite; | ||
| get hasNext(): boolean; | ||
@@ -63,0 +39,0 @@ get incrementalHandler(): Incremental.Handler<Record<string, unknown>>; |
@@ -109,3 +109,3 @@ "use strict";; | ||
| this.obsQueries.forEach((oq) => oq.stop()); | ||
| this.cancelPendingFetches((0, invariant_1.newInvariantError)(90)); | ||
| this.cancelPendingFetches((0, invariant_1.newInvariantError)(91)); | ||
| } | ||
@@ -125,3 +125,3 @@ cancelPendingFetches(error) { | ||
| this.localState, | ||
| 91, | ||
| 92, | ||
| (0, internal_1.getOperationName)(mutation, "(anonymous)") | ||
@@ -361,3 +361,3 @@ ); | ||
| // so far and not yet resolved (in the case of queries). | ||
| this.cancelPendingFetches((0, invariant_1.newInvariantError)(92)); | ||
| this.cancelPendingFetches((0, invariant_1.newInvariantError)(93)); | ||
| this.obsQueries.forEach((observableQuery) => { | ||
@@ -432,6 +432,6 @@ // Set loading to true so listeners don't trigger unless they want | ||
| if (queryName) { | ||
| __DEV__ && invariant_1.invariant.warn(93, queryName); | ||
| __DEV__ && invariant_1.invariant.warn(94, queryName); | ||
| } | ||
| else { | ||
| __DEV__ && invariant_1.invariant.warn(94); | ||
| __DEV__ && invariant_1.invariant.warn(95); | ||
| } | ||
@@ -465,3 +465,3 @@ } | ||
| !this.getDocumentInfo(query).hasClientExports || this.localState, | ||
| 95, | ||
| 96, | ||
| (0, internal_1.getOperationName)(query, "(anonymous)") | ||
@@ -611,3 +611,3 @@ ); | ||
| this.localState, | ||
| 96, | ||
| 97, | ||
| operation[0].toUpperCase() + operation.slice(1), | ||
@@ -619,3 +619,3 @@ operationName ?? "(anonymous)" | ||
| !hasIncrementalDirective, | ||
| 97, | ||
| 98, | ||
| operation[0].toUpperCase() + operation.slice(1), | ||
@@ -663,3 +663,2 @@ operationName ?? "(anonymous)" | ||
| if (hasErrors && errorPolicy === "none") { | ||
| queryInfo.resetLastWrite(); | ||
| observableQuery?.["resetNotifications"](); | ||
@@ -699,3 +698,2 @@ const error = new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result)); | ||
| if (errorPolicy === "none") { | ||
| queryInfo.resetLastWrite(); | ||
| observableQuery?.["resetNotifications"](); | ||
@@ -794,3 +792,3 @@ throw error; | ||
| this.localState, | ||
| 98, | ||
| 99, | ||
| (0, internal_1.getOperationName)(normalized.query, "(anonymous)") | ||
@@ -971,3 +969,3 @@ ); | ||
| __DEV__ && invariant_1.invariant.warn( | ||
| 99, | ||
| 100, | ||
| (0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`) | ||
@@ -1039,3 +1037,3 @@ ); | ||
| this.localState, | ||
| 100, | ||
| 101, | ||
| (0, internal_1.getOperationName)(query, "(anonymous)") | ||
@@ -1154,3 +1152,3 @@ ); | ||
| complete() { | ||
| (0, invariant_1.invariant)(didEmitValue, 101); | ||
| (0, invariant_1.invariant)(didEmitValue, 102); | ||
| }, | ||
@@ -1157,0 +1155,0 @@ }); |
@@ -37,3 +37,3 @@ "use strict";; | ||
| if (environment_1.__DEV__) { | ||
| __DEV__ && invariant_1.invariant.warn(102); | ||
| __DEV__ && invariant_1.invariant.warn(103); | ||
| } | ||
@@ -107,3 +107,3 @@ this.disconnect(); | ||
| if (environment_1.__DEV__) { | ||
| __DEV__ && invariant_1.invariant.warn(103, source); | ||
| __DEV__ && invariant_1.invariant.warn(104, source); | ||
| } | ||
@@ -114,3 +114,3 @@ return; | ||
| if (environment_1.__DEV__) { | ||
| __DEV__ && invariant_1.invariant.warn(104, source); | ||
| __DEV__ && invariant_1.invariant.warn(105, source); | ||
| } | ||
@@ -117,0 +117,0 @@ return; |
@@ -453,3 +453,3 @@ // This file is used by the error message display website and the | ||
| 90: { | ||
| 91: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -459,3 +459,3 @@ message: "QueryManager stopped while query was in flight" | ||
| 91: { | ||
| 92: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -466,3 +466,3 @@ condition: "this.localState", | ||
| 92: { | ||
| 93: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -472,3 +472,3 @@ message: "Store reset while query was in flight (not completed in link chain)" | ||
| 95: { | ||
| 96: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -479,3 +479,3 @@ condition: "!this.getDocumentInfo(query).hasClientExports || this.localState", | ||
| 96: { | ||
| 97: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -486,3 +486,3 @@ condition: "this.localState", | ||
| 97: { | ||
| 98: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -493,3 +493,3 @@ condition: "!hasIncrementalDirective", | ||
| 98: { | ||
| 99: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -500,3 +500,3 @@ condition: "this.localState", | ||
| 100: { | ||
| 101: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -507,3 +507,3 @@ condition: "this.localState", | ||
| 101: { | ||
| 102: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -514,3 +514,3 @@ condition: "didEmitValue", | ||
| 105: { | ||
| 106: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs", | ||
@@ -521,3 +521,3 @@ condition: "typeof dataId === \"string\"", | ||
| 108: { | ||
| 109: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/key-extractor.cjs", | ||
@@ -528,3 +528,3 @@ condition: "extracted !== void 0", | ||
| 109: { | ||
| 110: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/policies.cjs", | ||
@@ -535,3 +535,3 @@ condition: "!old || old === which", | ||
| 112: { | ||
| 113: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/policies.cjs", | ||
@@ -541,3 +541,3 @@ message: "Cannot automatically merge arrays" | ||
| 115: { | ||
| 116: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs", | ||
@@ -547,3 +547,3 @@ message: `No fragment named %s` | ||
| 116: { | ||
| 117: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs", | ||
@@ -554,3 +554,3 @@ condition: "!(0, utilities_1.isReference)(value)", | ||
| 117: { | ||
| 118: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs", | ||
@@ -560,3 +560,3 @@ message: `Could not identify object %s` | ||
| 119: { | ||
| 120: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs", | ||
@@ -674,2 +674,22 @@ message: `No fragment named %s` | ||
| 89: { | ||
| file: "@apollo/client/__cjs/core/ObservableQuery.cjs", | ||
| message: `Apollo Client stopped refetching '%s' because the same incomplete cache result was already refetched. Automatic refetching was halted to prevent an endless cycle of network requests. | ||
| This often means another query is overwriting non-normalized data selected by this query. Common fixes: | ||
| * Select an \`id\` or \`_id\` field in each query that writes the object | ||
| * Set custom \`keyFields\` if the object uses a different identity | ||
| * Add a field \`merge\` function so partial writes combine instead of replace | ||
| missing fields: %o | ||
| For more information about these options, please refer to the documentation: | ||
| * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers | ||
| * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects | ||
| ` | ||
| }, | ||
| 90: { | ||
| file: "@apollo/client/__cjs/core/QueryInfo.cjs", | ||
@@ -693,3 +713,3 @@ | ||
| 93: { | ||
| 94: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -699,3 +719,3 @@ message: `Unknown query named "%s" requested in refetchQueries options.include array` | ||
| 94: { | ||
| 95: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -705,3 +725,3 @@ message: `Unknown anonymous query requested in refetchQueries options.include array` | ||
| 99: { | ||
| 100: { | ||
| file: "@apollo/client/__cjs/core/QueryManager.cjs", | ||
@@ -711,3 +731,3 @@ message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.' | ||
| 102: { | ||
| 103: { | ||
| file: "@apollo/client/__cjs/core/RefetchEventManager.cjs", | ||
@@ -717,3 +737,3 @@ message: "Connected an `ApolloClient` instance to a `RefetchEventManager` that was already connected to a different `ApolloClient`. The previous client has been disconnected and will no longer receive refetch events from this manager." | ||
| 103: { | ||
| 104: { | ||
| file: "@apollo/client/__cjs/core/RefetchEventManager.cjs", | ||
@@ -723,3 +743,3 @@ message: "Received '%s' event but an `ApolloClient` instance is not connected to the `RefetchEventManager`. No queries will refetch. Pass the manager to the `refetchEventManager` option on the `ApolloClient` constructor." | ||
| 104: { | ||
| 105: { | ||
| file: "@apollo/client/__cjs/core/RefetchEventManager.cjs", | ||
@@ -729,3 +749,3 @@ message: "Received '%s' event but no source is configured for it on the `RefetchEventManager`. No queries will refetch. Add the event to the `sources` option or call `setEventSource`." | ||
| 106: { | ||
| 107: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs", | ||
@@ -738,3 +758,3 @@ | ||
| 107: { | ||
| 108: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs", | ||
@@ -746,3 +766,3 @@ | ||
| 110: { | ||
| 111: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/policies.cjs", | ||
@@ -752,3 +772,3 @@ message: `Inferring subtype %s of supertype %s` | ||
| 111: { | ||
| 112: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/policies.cjs", | ||
@@ -758,3 +778,3 @@ message: `Undefined 'from' passed to readField with arguments %s` | ||
| 113: { | ||
| 114: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/policies.cjs", | ||
@@ -764,3 +784,3 @@ message: "The field policy for '%s' is configured with the '%s' scalar, so its '%s' function is ignored. Scalar configuration cannot be used with custom read or merge functions." | ||
| 114: { | ||
| 115: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs", | ||
@@ -770,3 +790,3 @@ message: "The field policy for '%s' is configured with the '%s' scalar, but the field is not a scalar field because it contains a selection set. The field value remains unchanged." | ||
| 120: { | ||
| 121: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs", | ||
@@ -790,3 +810,3 @@ | ||
| 121: { | ||
| 122: { | ||
| file: "@apollo/client/__cjs/cache/core/cache.cjs", | ||
@@ -813,3 +833,3 @@ message: "Could not identify object passed to `from` for '%s' fragment, either because the object is non-normalized or the key fields are missing. If you are masking this object, please ensure the key fields are requested by the parent object." | ||
| 118: { | ||
| 119: { | ||
| file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs", | ||
@@ -816,0 +836,0 @@ message: `Missing field '%s' while writing result %o` |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.build = exports.version = void 0; | ||
| exports.version = "4.3.0-alpha.6"; | ||
| exports.version = "4.3.0-alpha.7"; | ||
| exports.build = "cjs"; | ||
| //# sourceMappingURL=version.cjs.map |
@@ -143,3 +143,3 @@ import { WeakCache } from "@wry/caches"; | ||
| if (id === undefined) { | ||
| __DEV__ && invariant.warn(121, actualFragmentName); | ||
| __DEV__ && invariant.warn(122, actualFragmentName); | ||
| } | ||
@@ -146,0 +146,0 @@ } |
@@ -76,3 +76,3 @@ import { equal } from "@wry/equality"; | ||
| return; | ||
| invariant(typeof dataId === "string", 105); | ||
| invariant(typeof dataId === "string", 106); | ||
| // Parse all scalars before merging so that the storeObjectReconciler can | ||
@@ -184,3 +184,3 @@ // deep compare the parsed value with the existing value | ||
| if (this.lookup(ref.__ref) === undefined) { | ||
| __DEV__ && invariant.warn(106, ref); | ||
| __DEV__ && invariant.warn(107, ref); | ||
| return true; | ||
@@ -214,3 +214,3 @@ } | ||
| if (seenReference && someNonReference !== undefined) { | ||
| __DEV__ && invariant.warn(107, someNonReference); | ||
| __DEV__ && invariant.warn(108, someNonReference); | ||
| break; | ||
@@ -217,0 +217,0 @@ } |
@@ -37,3 +37,3 @@ import { argumentsObjectFromField, DeepMerger, isArray, isNonEmptyArray, isNonNullObject, } from "@apollo/client/utilities/internal"; | ||
| } | ||
| invariant(extracted !== void 0, 108, schemaKeyPath.join("."), object); | ||
| invariant(extracted !== void 0, 109, schemaKeyPath.join("."), object); | ||
| return extracted; | ||
@@ -40,0 +40,0 @@ })); |
@@ -245,3 +245,3 @@ import { equal } from "@wry/equality"; | ||
| if (typename !== old) { | ||
| invariant(!old || old === which, 109, which); | ||
| invariant(!old || old === which, 110, which); | ||
| // First, delete any old __typename associated with this rootId from | ||
@@ -389,3 +389,3 @@ // rootIdsByTypename. | ||
| if (checkingFuzzySubtypes) { | ||
| __DEV__ && invariant.warn(110, typename, supertype); | ||
| __DEV__ && invariant.warn(111, typename, supertype); | ||
| } | ||
@@ -646,3 +646,3 @@ // Record positive results for faster future lookup. | ||
| if (__DEV__ && options.from === void 0) { | ||
| __DEV__ && invariant.warn(111, stringifyForDisplay(Array.from(readFieldArgs))); | ||
| __DEV__ && invariant.warn(112, stringifyForDisplay(Array.from(readFieldArgs))); | ||
| } | ||
@@ -657,3 +657,3 @@ if (void 0 === options.variables) { | ||
| if (isArray(existing) || isArray(incoming)) { | ||
| throw newInvariantError(112); | ||
| throw newInvariantError(113); | ||
| } | ||
@@ -695,4 +695,4 @@ // These dynamic checks are necessary because the parameters of a | ||
| function warnAboutScalarConfig(typename, fieldName, scalar, kind) { | ||
| __DEV__ && invariant.warn(113, `${typename}.${fieldName}`, scalar, kind); | ||
| __DEV__ && invariant.warn(114, `${typename}.${fieldName}`, scalar, kind); | ||
| } | ||
| //# sourceMappingURL=policies.js.map |
@@ -285,3 +285,3 @@ import { equal } from "@wry/equality"; | ||
| if (policy?.scalar) { | ||
| __DEV__ && invariant.warn(114, `${typename}.${fieldName}`, policy.scalar); | ||
| __DEV__ && invariant.warn(115, `${typename}.${fieldName}`, policy.scalar); | ||
| } | ||
@@ -323,3 +323,3 @@ } | ||
| if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) { | ||
| throw newInvariantError(115, selection.name.value); | ||
| throw newInvariantError(116, selection.name.value); | ||
| } | ||
@@ -621,3 +621,3 @@ if (fragment && policies.fragmentMatches(fragment, typename)) { | ||
| !isReference(value), | ||
| 116, | ||
| 117, | ||
| getTypenameFromStoreObject(store, value), | ||
@@ -624,0 +624,0 @@ field.name.value |
@@ -71,3 +71,3 @@ import { equal } from "@wry/equality"; | ||
| if (!isReference(ref)) { | ||
| throw newInvariantError(117, result); | ||
| throw newInvariantError(118, result); | ||
| } | ||
@@ -234,3 +234,3 @@ // So far, the store has not been modified, so now it's time to process | ||
| !policies.getReadFunction(typename, field.name.value)) { | ||
| invariant.error(118, resultKeyNameFromField(field), result); | ||
| invariant.error(119, resultKeyNameFromField(field), result); | ||
| } | ||
@@ -383,3 +383,3 @@ }); | ||
| if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) { | ||
| throw newInvariantError(119, selection.name.value); | ||
| throw newInvariantError(120, selection.name.value); | ||
| } | ||
@@ -556,3 +556,3 @@ if (fragment && | ||
| } | ||
| __DEV__ && invariant.warn(120, fieldName, parentType, childTypenames.length ? | ||
| __DEV__ && invariant.warn(121, fieldName, parentType, childTypenames.length ? | ||
| "either ensure all objects of type " + | ||
@@ -559,0 +559,0 @@ childTypenames.join(" and ") + |
@@ -281,8 +281,4 @@ import type { DocumentNode } from "graphql"; | ||
| private variablesUnknown; | ||
| /** | ||
| * @internal will be read and written from `QueryInfo` | ||
| * | ||
| * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. | ||
| */ | ||
| _lastWrite?: unknown; | ||
| private didWarnOnFeud; | ||
| private lastMissing?; | ||
| get query(): TypedDocumentNode<TData, TVariables>; | ||
@@ -473,2 +469,3 @@ /** | ||
| notify(scheduled?: boolean): void; | ||
| private deliverCacheDiff; | ||
| private activeOperations; | ||
@@ -475,0 +472,0 @@ private pushOperation; |
+1
-25
@@ -19,8 +19,2 @@ import type { DocumentNode, FormattedExecutionResult } from "graphql"; | ||
| } | ||
| interface LastWrite { | ||
| result: FormattedExecutionResult<any, ExtensionsWithStreamInfo>; | ||
| variables: ApolloClient.WatchQueryOptions["variables"]; | ||
| dmCount: number | undefined; | ||
| hasNext: boolean; | ||
| } | ||
| interface OperationInfo<TData, TVariables extends OperationVariables, AllowedCacheWriteBehavior = CacheWriteBehavior> { | ||
@@ -43,20 +37,2 @@ document: DocumentNode | TypedDocumentNode<TData, TVariables>; | ||
| constructor(queryManager: QueryManager, observableQuery?: ObservableQuery<any, any>); | ||
| /** | ||
| * @internal | ||
| * Tracks the last result written to the cache so that `shouldWrite` can skip | ||
| * an identical write. Since a `QueryInfo` only ever represents a single | ||
| * network request, this is shared by all `QueryInfo` instances of an | ||
| * `ObservableQuery`. A standalone `QueryInfo` keeps a local version. | ||
| * | ||
| * A network result that was explicitly asked for always takes precedence over | ||
| * what is already cached, so `ObservableQuery.refetch` and polling clear this | ||
| * value before starting their request. | ||
| * | ||
| * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. | ||
| */ | ||
| _lastWrite?: LastWrite; | ||
| private get lastWrite(); | ||
| private set lastWrite(value); | ||
| resetLastWrite(): void; | ||
| private shouldWrite; | ||
| get hasNext(): boolean; | ||
@@ -91,2 +67,2 @@ get incrementalHandler(): Incremental.Handler<Record<string, unknown>>; | ||
| export {}; | ||
| //# sourceMappingURL=QueryInfo.d.ts.map | ||
| //# sourceMappingURL=QueryInfo.d.ts.map |
+11
-125
@@ -1,2 +0,1 @@ | ||
| import { equal } from "@wry/equality"; | ||
| import { Trie } from "@wry/trie"; | ||
@@ -8,19 +7,2 @@ import { __DEV__ } from "@apollo/client/utilities/environment"; | ||
| const IGNORE = {}; | ||
| const destructiveMethodCounts = new WeakMap(); | ||
| function wrapDestructiveCacheMethod(cache, methodName) { | ||
| const original = cache[methodName]; | ||
| if (typeof original === "function") { | ||
| // @ts-expect-error this is just too generic to be typed correctly | ||
| cache[methodName] = function () { | ||
| destructiveMethodCounts.set(cache, | ||
| // The %1e15 allows the count to wrap around to 0 safely every | ||
| // quadrillion evictions, so there's no risk of overflow. To be | ||
| // clear, this is more of a pedantic principle than something | ||
| // that matters in any conceivable practical scenario. | ||
| (destructiveMethodCounts.get(cache) + 1) % 1e15); | ||
| // @ts-expect-error this is just too generic to be typed correctly | ||
| return original.apply(this, arguments); | ||
| }; | ||
| } | ||
| } | ||
| const queryInfoIds = new WeakMap(); | ||
@@ -39,3 +21,3 @@ // A QueryInfo object represents a single network request, either initiated | ||
| constructor(queryManager, observableQuery) { | ||
| const cache = (this.cache = queryManager.cache); | ||
| this.cache = queryManager.cache; | ||
| const id = (queryInfoIds.get(queryManager) || 0) + 1; | ||
@@ -46,51 +28,3 @@ queryInfoIds.set(queryManager, id); | ||
| this.queryManager = queryManager; | ||
| // Track how often cache.evict is called, since we want eviction to | ||
| // override the write-skipping logic in `shouldWrite`, by causing it to | ||
| // return true. Wrapping the cache.evict method is a bit of a hack, but it | ||
| // saves us from having to make eviction counting an official part of the | ||
| // ApolloCache API. | ||
| if (!destructiveMethodCounts.has(cache)) { | ||
| destructiveMethodCounts.set(cache, 0); | ||
| wrapDestructiveCacheMethod(cache, "evict"); | ||
| wrapDestructiveCacheMethod(cache, "modify"); | ||
| wrapDestructiveCacheMethod(cache, "reset"); | ||
| } | ||
| } | ||
| /** | ||
| * @internal | ||
| * Tracks the last result written to the cache so that `shouldWrite` can skip | ||
| * an identical write. Since a `QueryInfo` only ever represents a single | ||
| * network request, this is shared by all `QueryInfo` instances of an | ||
| * `ObservableQuery`. A standalone `QueryInfo` keeps a local version. | ||
| * | ||
| * A network result that was explicitly asked for always takes precedence over | ||
| * what is already cached, so `ObservableQuery.refetch` and polling clear this | ||
| * value before starting their request. | ||
| * | ||
| * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time. | ||
| */ | ||
| _lastWrite; | ||
| get lastWrite() { | ||
| return (this.observableQuery || this)._lastWrite; | ||
| } | ||
| set lastWrite(value) { | ||
| (this.observableQuery || this)._lastWrite = value; | ||
| } | ||
| resetLastWrite() { | ||
| this.lastWrite = void 0; | ||
| } | ||
| shouldWrite(result, variables) { | ||
| const { lastWrite } = this; | ||
| return (!lastWrite || | ||
| // If cache.evict has been called since the last time we wrote this | ||
| // data into the cache, there's a chance writing this result into | ||
| // the cache will repair what was evicted. | ||
| lastWrite.dmCount !== destructiveMethodCounts.get(this.cache) || | ||
| !equal(variables, lastWrite.variables) || | ||
| !equal(result.data, lastWrite.result.data) || | ||
| // We have to compare these values because its possible the final chunk | ||
| // emitted in the incremental result is just `hasNext: false`. This | ||
| // ensures we trigger a cache write when we get `isLastChunk: true`. | ||
| lastWrite.hasNext !== this.hasNext); | ||
| } | ||
| get hasNext() { | ||
@@ -161,10 +95,5 @@ return this.incremental ? this.incremental.hasNext : false; | ||
| } | ||
| if (skipCache) { | ||
| if (skipCache || !shouldWriteResult(result, errorPolicy)) { | ||
| return result; | ||
| } | ||
| if (!shouldWriteResult(result, errorPolicy)) { | ||
| this.lastWrite = void 0; | ||
| return result; | ||
| } | ||
| let written = false; | ||
| // Using a transaction here so we have a chance to read the result | ||
@@ -185,51 +114,9 @@ // back from the cache before the watch callback fires as a result | ||
| update: (cache) => { | ||
| const shouldWrite = this.shouldWrite(result, variables); | ||
| // If result is the same as the last result we received from | ||
| // the network (and the variables match too), avoid writing | ||
| // result into the cache again. The wisdom of skipping this | ||
| // cache write is far from obvious, since any cache write | ||
| // could be the one that puts the cache back into a desired | ||
| // state, fixing corruption or missing data. However, if we | ||
| // always write every network result into the cache, we enable | ||
| // feuds between queries competing to update the same data in | ||
| // incompatible ways, which can lead to an endless cycle of | ||
| // cache broadcasts and useless network requests. As with any | ||
| // feud, eventually one side must step back from the brink, | ||
| // letting the other side(s) have the last word(s). There may | ||
| // be other points where we could break this cycle, such as | ||
| // silencing the broadcast for cache.writeQuery (not a good | ||
| // idea, since it just delays the feud a bit) or somehow | ||
| // avoiding the network request that just happened (also bad, | ||
| // because the server could return useful new data). All | ||
| // options considered, skipping this cache write seems to be | ||
| // the least damaging place to break the cycle, because it | ||
| // reflects the intuition that we recently wrote this exact | ||
| // result into the cache, so the cache *should* already/still | ||
| // contain this data. If some other query has clobbered that | ||
| // data in the meantime, that's too bad, but there will be no | ||
| // winners if every query blindly reverts to its own version | ||
| // of the data. This approach also gives the network a chance | ||
| // to return new data, which will be written into the cache as | ||
| // usual, notifying only those queries that are directly | ||
| // affected by the cache updates, as usual. In the future, an | ||
| // even more sophisticated cache could perhaps prevent or | ||
| // mitigate the clobbering somehow, but that would make this | ||
| // particular cache write even less important, and thus | ||
| // skipping it would be even safer than it is today. | ||
| if (shouldWrite) { | ||
| cache.writeQuery({ | ||
| query, | ||
| data: result.data, | ||
| variables, | ||
| overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */, | ||
| extensions: result.extensions, | ||
| }); | ||
| this.lastWrite = { | ||
| result, | ||
| variables, | ||
| dmCount: destructiveMethodCounts.get(this.cache), | ||
| hasNext: this.hasNext, | ||
| }; | ||
| written = true; | ||
| } | ||
| cache.writeQuery({ | ||
| query, | ||
| data: result.data, | ||
| variables, | ||
| overwrite: cacheWriteBehavior === 1 /* CacheWriteBehavior.OVERWRITE */, | ||
| extensions: result.extensions, | ||
| }); | ||
| const { dataState, result: diffResult } = this.getDiff({ | ||
@@ -244,7 +131,6 @@ ...diffOptions, | ||
| dataState === "streaming" || | ||
| (returnPartialData && dataState === "partial" && shouldWrite)) { | ||
| (returnPartialData && dataState === "partial")) { | ||
| result = { ...result, data: diffResult, dataState }; | ||
| } | ||
| else if (__DEV__ && | ||
| written && | ||
| // A result that is still streaming is expected to read back | ||
@@ -486,3 +372,3 @@ // incomplete until the remaining chunks arrive. | ||
| __DEV__ && invariant.warn( | ||
| 89, | ||
| 90, | ||
| getOperationName(query, "(anonymous)"), | ||
@@ -489,0 +375,0 @@ diff.missing?.missing, |
+12
-14
@@ -102,3 +102,3 @@ import { Trie } from "@wry/trie"; | ||
| this.obsQueries.forEach((oq) => oq.stop()); | ||
| this.cancelPendingFetches(newInvariantError(90)); | ||
| this.cancelPendingFetches(newInvariantError(91)); | ||
| } | ||
@@ -116,3 +116,3 @@ cancelPendingFetches(error) { | ||
| if (__DEV__) { | ||
| invariant(this.localState, 91, getOperationName(mutation, "(anonymous)")); | ||
| invariant(this.localState, 92, getOperationName(mutation, "(anonymous)")); | ||
| } | ||
@@ -350,3 +350,3 @@ variables = await this.localState.getExportedVariables({ | ||
| // so far and not yet resolved (in the case of queries). | ||
| this.cancelPendingFetches(newInvariantError(92)); | ||
| this.cancelPendingFetches(newInvariantError(93)); | ||
| this.obsQueries.forEach((observableQuery) => { | ||
@@ -421,6 +421,6 @@ // Set loading to true so listeners don't trigger unless they want | ||
| if (queryName) { | ||
| __DEV__ && invariant.warn(93, queryName); | ||
| __DEV__ && invariant.warn(94, queryName); | ||
| } | ||
| else { | ||
| __DEV__ && invariant.warn(94); | ||
| __DEV__ && invariant.warn(95); | ||
| } | ||
@@ -454,3 +454,3 @@ } | ||
| !this.getDocumentInfo(query).hasClientExports || this.localState, | ||
| 95, | ||
| 96, | ||
| getOperationName(query, "(anonymous)") | ||
@@ -600,3 +600,3 @@ ); | ||
| this.localState, | ||
| 96, | ||
| 97, | ||
| operation[0].toUpperCase() + operation.slice(1), | ||
@@ -608,3 +608,3 @@ operationName ?? "(anonymous)" | ||
| !hasIncrementalDirective, | ||
| 97, | ||
| 98, | ||
| operation[0].toUpperCase() + operation.slice(1), | ||
@@ -652,3 +652,2 @@ operationName ?? "(anonymous)" | ||
| if (hasErrors && errorPolicy === "none") { | ||
| queryInfo.resetLastWrite(); | ||
| observableQuery?.["resetNotifications"](); | ||
@@ -688,3 +687,2 @@ const error = new CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result)); | ||
| if (errorPolicy === "none") { | ||
| queryInfo.resetLastWrite(); | ||
| observableQuery?.["resetNotifications"](); | ||
@@ -781,3 +779,3 @@ throw error; | ||
| if (__DEV__) { | ||
| invariant(this.localState, 98, getOperationName(normalized.query, "(anonymous)")); | ||
| invariant(this.localState, 99, getOperationName(normalized.query, "(anonymous)")); | ||
| } | ||
@@ -955,3 +953,3 @@ observable = from(this.localState.getExportedVariables({ | ||
| this.noCacheWarningsByCause.add(cause); | ||
| __DEV__ && invariant.warn(99, getOperationName(document, `Unnamed ${operationType ?? "operation"}`)); | ||
| __DEV__ && invariant.warn(100, getOperationName(document, `Unnamed ${operationType ?? "operation"}`)); | ||
| } | ||
@@ -1019,3 +1017,3 @@ } | ||
| if (__DEV__) { | ||
| invariant(this.localState, 100, getOperationName(query, "(anonymous)")); | ||
| invariant(this.localState, 101, getOperationName(query, "(anonymous)")); | ||
| } | ||
@@ -1131,3 +1129,3 @@ onCacheHit(); | ||
| complete() { | ||
| invariant(didEmitValue, 101); | ||
| invariant(didEmitValue, 102); | ||
| }, | ||
@@ -1134,0 +1132,0 @@ }); |
@@ -30,3 +30,3 @@ import { __DEV__ } from "@apollo/client/utilities/environment"; | ||
| if (__DEV__) { | ||
| __DEV__ && invariant.warn(102); | ||
| __DEV__ && invariant.warn(103); | ||
| } | ||
@@ -100,3 +100,3 @@ this.disconnect(); | ||
| if (__DEV__) { | ||
| __DEV__ && invariant.warn(103, source); | ||
| __DEV__ && invariant.warn(104, source); | ||
| } | ||
@@ -107,3 +107,3 @@ return; | ||
| if (__DEV__) { | ||
| __DEV__ && invariant.warn(104, source); | ||
| __DEV__ && invariant.warn(105, source); | ||
| } | ||
@@ -110,0 +110,0 @@ return; |
+52
-32
@@ -447,3 +447,3 @@ // This file is used by the error message display website and the | ||
| 90: { | ||
| 91: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -453,3 +453,3 @@ message: "QueryManager stopped while query was in flight" | ||
| 91: { | ||
| 92: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -460,3 +460,3 @@ condition: "this.localState", | ||
| 92: { | ||
| 93: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -466,3 +466,3 @@ message: "Store reset while query was in flight (not completed in link chain)" | ||
| 95: { | ||
| 96: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -473,3 +473,3 @@ condition: "!this.getDocumentInfo(query).hasClientExports || this.localState", | ||
| 96: { | ||
| 97: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -480,3 +480,3 @@ condition: "this.localState", | ||
| 97: { | ||
| 98: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -487,3 +487,3 @@ condition: "!hasIncrementalDirective", | ||
| 98: { | ||
| 99: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -494,3 +494,3 @@ condition: "this.localState", | ||
| 100: { | ||
| 101: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -501,3 +501,3 @@ condition: "this.localState", | ||
| 101: { | ||
| 102: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -508,3 +508,3 @@ condition: "didEmitValue", | ||
| 105: { | ||
| 106: { | ||
| file: "@apollo/client/cache/inmemory/entityStore.js", | ||
@@ -515,3 +515,3 @@ condition: "typeof dataId === \"string\"", | ||
| 108: { | ||
| 109: { | ||
| file: "@apollo/client/cache/inmemory/key-extractor.js", | ||
@@ -522,3 +522,3 @@ condition: "extracted !== void 0", | ||
| 109: { | ||
| 110: { | ||
| file: "@apollo/client/cache/inmemory/policies.js", | ||
@@ -529,3 +529,3 @@ condition: "!old || old === which", | ||
| 112: { | ||
| 113: { | ||
| file: "@apollo/client/cache/inmemory/policies.js", | ||
@@ -535,3 +535,3 @@ message: "Cannot automatically merge arrays" | ||
| 115: { | ||
| 116: { | ||
| file: "@apollo/client/cache/inmemory/readFromStore.js", | ||
@@ -541,3 +541,3 @@ message: `No fragment named %s` | ||
| 116: { | ||
| 117: { | ||
| file: "@apollo/client/cache/inmemory/readFromStore.js", | ||
@@ -548,3 +548,3 @@ condition: "!isReference(value)", | ||
| 117: { | ||
| 118: { | ||
| file: "@apollo/client/cache/inmemory/writeToStore.js", | ||
@@ -554,3 +554,3 @@ message: `Could not identify object %s` | ||
| 119: { | ||
| 120: { | ||
| file: "@apollo/client/cache/inmemory/writeToStore.js", | ||
@@ -668,2 +668,22 @@ message: `No fragment named %s` | ||
| 89: { | ||
| file: "@apollo/client/core/ObservableQuery.js", | ||
| message: `Apollo Client stopped refetching '%s' because the same incomplete cache result was already refetched. Automatic refetching was halted to prevent an endless cycle of network requests. | ||
| This often means another query is overwriting non-normalized data selected by this query. Common fixes: | ||
| * Select an \`id\` or \`_id\` field in each query that writes the object | ||
| * Set custom \`keyFields\` if the object uses a different identity | ||
| * Add a field \`merge\` function so partial writes combine instead of replace | ||
| missing fields: %o | ||
| For more information about these options, please refer to the documentation: | ||
| * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers | ||
| * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects | ||
| ` | ||
| }, | ||
| 90: { | ||
| file: "@apollo/client/core/QueryInfo.js", | ||
@@ -687,3 +707,3 @@ | ||
| 93: { | ||
| 94: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -693,3 +713,3 @@ message: `Unknown query named "%s" requested in refetchQueries options.include array` | ||
| 94: { | ||
| 95: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -699,3 +719,3 @@ message: `Unknown anonymous query requested in refetchQueries options.include array` | ||
| 99: { | ||
| 100: { | ||
| file: "@apollo/client/core/QueryManager.js", | ||
@@ -705,3 +725,3 @@ message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.' | ||
| 102: { | ||
| 103: { | ||
| file: "@apollo/client/core/RefetchEventManager.js", | ||
@@ -711,3 +731,3 @@ message: "Connected an `ApolloClient` instance to a `RefetchEventManager` that was already connected to a different `ApolloClient`. The previous client has been disconnected and will no longer receive refetch events from this manager." | ||
| 103: { | ||
| 104: { | ||
| file: "@apollo/client/core/RefetchEventManager.js", | ||
@@ -717,3 +737,3 @@ message: "Received '%s' event but an `ApolloClient` instance is not connected to the `RefetchEventManager`. No queries will refetch. Pass the manager to the `refetchEventManager` option on the `ApolloClient` constructor." | ||
| 104: { | ||
| 105: { | ||
| file: "@apollo/client/core/RefetchEventManager.js", | ||
@@ -723,3 +743,3 @@ message: "Received '%s' event but no source is configured for it on the `RefetchEventManager`. No queries will refetch. Add the event to the `sources` option or call `setEventSource`." | ||
| 106: { | ||
| 107: { | ||
| file: "@apollo/client/cache/inmemory/entityStore.js", | ||
@@ -732,3 +752,3 @@ | ||
| 107: { | ||
| 108: { | ||
| file: "@apollo/client/cache/inmemory/entityStore.js", | ||
@@ -740,3 +760,3 @@ | ||
| 110: { | ||
| 111: { | ||
| file: "@apollo/client/cache/inmemory/policies.js", | ||
@@ -746,3 +766,3 @@ message: `Inferring subtype %s of supertype %s` | ||
| 111: { | ||
| 112: { | ||
| file: "@apollo/client/cache/inmemory/policies.js", | ||
@@ -752,3 +772,3 @@ message: `Undefined 'from' passed to readField with arguments %s` | ||
| 113: { | ||
| 114: { | ||
| file: "@apollo/client/cache/inmemory/policies.js", | ||
@@ -758,3 +778,3 @@ message: "The field policy for '%s' is configured with the '%s' scalar, so its '%s' function is ignored. Scalar configuration cannot be used with custom read or merge functions." | ||
| 114: { | ||
| 115: { | ||
| file: "@apollo/client/cache/inmemory/readFromStore.js", | ||
@@ -764,3 +784,3 @@ message: "The field policy for '%s' is configured with the '%s' scalar, but the field is not a scalar field because it contains a selection set. The field value remains unchanged." | ||
| 120: { | ||
| 121: { | ||
| file: "@apollo/client/cache/inmemory/writeToStore.js", | ||
@@ -784,3 +804,3 @@ | ||
| 121: { | ||
| 122: { | ||
| file: "@apollo/client/cache/core/cache.js", | ||
@@ -807,3 +827,3 @@ message: "Could not identify object passed to `from` for '%s' fragment, either because the object is non-normalized or the key fields are missing. If you are masking this object, please ensure the key fields are requested by the parent object." | ||
| 118: { | ||
| 119: { | ||
| file: "@apollo/client/cache/inmemory/writeToStore.js", | ||
@@ -810,0 +830,0 @@ message: `Missing field '%s' while writing result %o` |
+1
-1
| { | ||
| "name": "@apollo/client", | ||
| "version": "4.3.0-alpha.6", | ||
| "version": "4.3.0-alpha.7", | ||
| "description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
+1
-1
@@ -1,3 +0,3 @@ | ||
| export const version = "4.3.0-alpha.6"; | ||
| export const version = "4.3.0-alpha.7"; | ||
| export const build = "esm"; | ||
| //# sourceMappingURL=version.js.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
12787173
0.07%72037
-0.02%