@apollo/client 3.6.0-beta.8 → 3.6.0-beta.9
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 +26 -12
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.d.ts +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +22 -9
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +4 -2
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +26 -12
- package/core/core.cjs.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/watchQueryOptions.d.ts +8 -1
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/package.json +1 -1
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -1294,7 +1294,7 @@ var concat = ApolloLink.concat;
|
|
|
1294
1294
|
|
|
1295
1295
|
var execute = ApolloLink.execute;
|
|
1296
1296
|
|
|
1297
|
-
var version = '3.6.0-beta.
|
|
1297
|
+
var version = '3.6.0-beta.9';
|
|
1298
1298
|
|
|
1299
1299
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1300
1300
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -4194,6 +4194,27 @@ var ObservableQuery = (function (_super) {
|
|
|
4194
4194
|
this.options.pollInterval = 0;
|
|
4195
4195
|
this.updatePolling();
|
|
4196
4196
|
};
|
|
4197
|
+
ObservableQuery.prototype.applyNextFetchPolicy = function (reason, options) {
|
|
4198
|
+
if (options === void 0) { options = this.options; }
|
|
4199
|
+
if (options.nextFetchPolicy) {
|
|
4200
|
+
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
4201
|
+
if (typeof options.nextFetchPolicy === "function") {
|
|
4202
|
+
options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {
|
|
4203
|
+
reason: reason,
|
|
4204
|
+
options: options,
|
|
4205
|
+
observable: this,
|
|
4206
|
+
initialPolicy: this.initialFetchPolicy,
|
|
4207
|
+
});
|
|
4208
|
+
}
|
|
4209
|
+
else if (reason === "variables-changed") {
|
|
4210
|
+
options.fetchPolicy = this.initialFetchPolicy;
|
|
4211
|
+
}
|
|
4212
|
+
else {
|
|
4213
|
+
options.fetchPolicy = options.nextFetchPolicy;
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4216
|
+
return options.fetchPolicy;
|
|
4217
|
+
};
|
|
4197
4218
|
ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
|
|
4198
4219
|
this.queryManager.setObservableQuery(this);
|
|
4199
4220
|
return this.queryManager.fetchQueryObservable(this.queryId, options, newNetworkStatus);
|
|
@@ -4265,7 +4286,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4265
4286
|
newOptions.variables &&
|
|
4266
4287
|
!newOptions.fetchPolicy &&
|
|
4267
4288
|
!equal.equal(newOptions.variables, oldVariables)) {
|
|
4268
|
-
|
|
4289
|
+
this.applyNextFetchPolicy("variables-changed");
|
|
4269
4290
|
if (newNetworkStatus === void 0) {
|
|
4270
4291
|
newNetworkStatus = exports.NetworkStatus.setVariables;
|
|
4271
4292
|
}
|
|
@@ -4337,14 +4358,6 @@ function logMissingFieldErrors(missing) {
|
|
|
4337
4358
|
__DEV__ && tsInvariant.invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
|
|
4338
4359
|
}
|
|
4339
4360
|
}
|
|
4340
|
-
function applyNextFetchPolicy(options) {
|
|
4341
|
-
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, nextFetchPolicy = options.nextFetchPolicy;
|
|
4342
|
-
if (nextFetchPolicy) {
|
|
4343
|
-
options.fetchPolicy = typeof nextFetchPolicy === "function"
|
|
4344
|
-
? nextFetchPolicy.call(options, fetchPolicy)
|
|
4345
|
-
: nextFetchPolicy;
|
|
4346
|
-
}
|
|
4347
|
-
}
|
|
4348
4361
|
|
|
4349
4362
|
var LocalState = (function () {
|
|
4350
4363
|
function LocalState(_a) {
|
|
@@ -5510,7 +5523,9 @@ var QueryManager = (function () {
|
|
|
5510
5523
|
: fromVariables(normalized.variables));
|
|
5511
5524
|
concast.cleanup(function () {
|
|
5512
5525
|
_this.fetchCancelFns.delete(queryId);
|
|
5513
|
-
|
|
5526
|
+
if (queryInfo.observableQuery) {
|
|
5527
|
+
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
5528
|
+
}
|
|
5514
5529
|
});
|
|
5515
5530
|
return concast;
|
|
5516
5531
|
};
|
|
@@ -6596,7 +6611,6 @@ exports.HttpLink = HttpLink;
|
|
|
6596
6611
|
exports.InMemoryCache = InMemoryCache;
|
|
6597
6612
|
exports.MissingFieldError = MissingFieldError;
|
|
6598
6613
|
exports.ObservableQuery = ObservableQuery;
|
|
6599
|
-
exports.applyNextFetchPolicy = applyNextFetchPolicy;
|
|
6600
6614
|
exports.checkFetcher = checkFetcher;
|
|
6601
6615
|
exports.concat = concat;
|
|
6602
6616
|
exports.createHttpLink = createHttpLink;
|