@apollo/client 3.7.15 → 3.7.17
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/apollo-client.cjs +18 -5
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +1 -1
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -0
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +16 -3
- package/core/ObservableQuery.js.map +1 -1
- package/core/core.cjs +17 -4
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +17 -4
- package/invariantErrorCodes.js +1 -1
- package/link/batch-http/batchHttpLink.d.ts +1 -1
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/persisted-queries/index.d.ts +10 -4
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +25 -28
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +24 -27
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +24 -27
- package/package.json +19 -19
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +3 -0
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/utilities.cjs +3 -0
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +3 -0
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -1370,7 +1370,7 @@ var concat = ApolloLink.concat;
|
|
|
1370
1370
|
|
|
1371
1371
|
var execute = ApolloLink.execute;
|
|
1372
1372
|
|
|
1373
|
-
var version = '3.7.
|
|
1373
|
+
var version = '3.7.17';
|
|
1374
1374
|
|
|
1375
1375
|
function isNodeResponse(value) {
|
|
1376
1376
|
return !!value.body;
|
|
@@ -4007,7 +4007,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4007
4007
|
}
|
|
4008
4008
|
});
|
|
4009
4009
|
}
|
|
4010
|
-
__DEV__ && tsInvariant.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
|
|
4010
|
+
__DEV__ && tsInvariant.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
|
|
4011
4011
|
? "either ensure all objects of type " +
|
|
4012
4012
|
childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
4013
4013
|
: "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1000), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1000), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
|
|
@@ -4362,6 +4362,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4362
4362
|
_this.subscriptions = new Set();
|
|
4363
4363
|
_this.queryInfo = queryInfo;
|
|
4364
4364
|
_this.queryManager = queryManager;
|
|
4365
|
+
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
4365
4366
|
_this.isTornDown = false;
|
|
4366
4367
|
var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
|
|
4367
4368
|
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, _f = options.initialFetchPolicy, initialFetchPolicy = _f === void 0 ? (fetchPolicy === "standby" ? defaultFetchPolicy : fetchPolicy) : _f;
|
|
@@ -4412,10 +4413,11 @@ var ObservableQuery = (function (_super) {
|
|
|
4412
4413
|
exports.NetworkStatus.ready;
|
|
4413
4414
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
4414
4415
|
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
4415
|
-
if (fetchPolicy
|
|
4416
|
-
fetchPolicy === 'no-cache' ||
|
|
4417
|
-
fetchPolicy === 'standby' ||
|
|
4416
|
+
if (skipCacheDataFor(fetchPolicy) ||
|
|
4418
4417
|
this.queryManager.transform(this.options.query).hasForcedResolvers) ;
|
|
4418
|
+
else if (this.waitForOwnResult) {
|
|
4419
|
+
this.queryInfo['updateWatch']();
|
|
4420
|
+
}
|
|
4419
4421
|
else {
|
|
4420
4422
|
var diff = this.queryInfo.getDiff();
|
|
4421
4423
|
if (diff.complete || this.options.returnPartialData) {
|
|
@@ -4737,13 +4739,21 @@ var ObservableQuery = (function (_super) {
|
|
|
4737
4739
|
}
|
|
4738
4740
|
}
|
|
4739
4741
|
}
|
|
4742
|
+
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));
|
|
4743
|
+
var finishWaitingForOwnResult = function () {
|
|
4744
|
+
if (_this.concast === concast) {
|
|
4745
|
+
_this.waitForOwnResult = false;
|
|
4746
|
+
}
|
|
4747
|
+
};
|
|
4740
4748
|
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
4741
4749
|
var _a = this.fetch(options, newNetworkStatus), concast = _a.concast, fromLink = _a.fromLink;
|
|
4742
4750
|
var observer = {
|
|
4743
4751
|
next: function (result) {
|
|
4752
|
+
finishWaitingForOwnResult();
|
|
4744
4753
|
_this.reportResult(result, variables);
|
|
4745
4754
|
},
|
|
4746
4755
|
error: function (error) {
|
|
4756
|
+
finishWaitingForOwnResult();
|
|
4747
4757
|
_this.reportError(error, variables);
|
|
4748
4758
|
},
|
|
4749
4759
|
};
|
|
@@ -4823,6 +4833,9 @@ function logMissingFieldErrors(missing) {
|
|
|
4823
4833
|
__DEV__ && tsInvariant.invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
|
|
4824
4834
|
}
|
|
4825
4835
|
}
|
|
4836
|
+
function skipCacheDataFor(fetchPolicy) {
|
|
4837
|
+
return fetchPolicy === "network-only" || fetchPolicy === "no-cache" || fetchPolicy === "standby";
|
|
4838
|
+
}
|
|
4826
4839
|
|
|
4827
4840
|
var LocalState = (function () {
|
|
4828
4841
|
function LocalState(_a) {
|