@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/core/core.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var utils = require('../link/utils');
|
|
|
15
15
|
var tsInvariant = require('ts-invariant');
|
|
16
16
|
var graphqlTag = require('graphql-tag');
|
|
17
17
|
|
|
18
|
-
var version = '3.7.
|
|
18
|
+
var version = '3.7.17';
|
|
19
19
|
|
|
20
20
|
function isNonNullObject(obj) {
|
|
21
21
|
return obj !== null && typeof obj === 'object';
|
|
@@ -159,6 +159,7 @@ var ObservableQuery = (function (_super) {
|
|
|
159
159
|
_this.subscriptions = new Set();
|
|
160
160
|
_this.queryInfo = queryInfo;
|
|
161
161
|
_this.queryManager = queryManager;
|
|
162
|
+
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
162
163
|
_this.isTornDown = false;
|
|
163
164
|
var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? "cache-first" : _d;
|
|
164
165
|
var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, _f = options.initialFetchPolicy, initialFetchPolicy = _f === void 0 ? (fetchPolicy === "standby" ? defaultFetchPolicy : fetchPolicy) : _f;
|
|
@@ -209,10 +210,11 @@ var ObservableQuery = (function (_super) {
|
|
|
209
210
|
exports.NetworkStatus.ready;
|
|
210
211
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
211
212
|
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
212
|
-
if (fetchPolicy
|
|
213
|
-
fetchPolicy === 'no-cache' ||
|
|
214
|
-
fetchPolicy === 'standby' ||
|
|
213
|
+
if (skipCacheDataFor(fetchPolicy) ||
|
|
215
214
|
this.queryManager.transform(this.options.query).hasForcedResolvers) ;
|
|
215
|
+
else if (this.waitForOwnResult) {
|
|
216
|
+
this.queryInfo['updateWatch']();
|
|
217
|
+
}
|
|
216
218
|
else {
|
|
217
219
|
var diff = this.queryInfo.getDiff();
|
|
218
220
|
if (diff.complete || this.options.returnPartialData) {
|
|
@@ -534,13 +536,21 @@ var ObservableQuery = (function (_super) {
|
|
|
534
536
|
}
|
|
535
537
|
}
|
|
536
538
|
}
|
|
539
|
+
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));
|
|
540
|
+
var finishWaitingForOwnResult = function () {
|
|
541
|
+
if (_this.concast === concast) {
|
|
542
|
+
_this.waitForOwnResult = false;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
537
545
|
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
538
546
|
var _a = this.fetch(options, newNetworkStatus), concast = _a.concast, fromLink = _a.fromLink;
|
|
539
547
|
var observer = {
|
|
540
548
|
next: function (result) {
|
|
549
|
+
finishWaitingForOwnResult();
|
|
541
550
|
_this.reportResult(result, variables);
|
|
542
551
|
},
|
|
543
552
|
error: function (error) {
|
|
553
|
+
finishWaitingForOwnResult();
|
|
544
554
|
_this.reportError(error, variables);
|
|
545
555
|
},
|
|
546
556
|
};
|
|
@@ -620,6 +630,9 @@ function logMissingFieldErrors(missing) {
|
|
|
620
630
|
__DEV__ && globals.invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
|
|
621
631
|
}
|
|
622
632
|
}
|
|
633
|
+
function skipCacheDataFor(fetchPolicy) {
|
|
634
|
+
return fetchPolicy === "network-only" || fetchPolicy === "no-cache" || fetchPolicy === "standby";
|
|
635
|
+
}
|
|
623
636
|
|
|
624
637
|
var LocalState = (function () {
|
|
625
638
|
function LocalState(_a) {
|