@apollo/client 3.7.0-beta.5 → 3.7.0-beta.6
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/README.md +1 -0
- package/apollo-client.cjs +26 -16
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +5 -2
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -7
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +15 -10
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +15 -10
- package/invariantErrorCodes.js +1 -1
- package/package.json +11 -11
- package/react/hooks/hooks.cjs +11 -6
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +11 -6
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +11 -6
- package/react/hooks/useQuery.js.map +1 -1
- package/utilities/observables/Concast.d.ts +1 -0
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
22
22
|
## Apollo Maintainers
|
|
23
23
|
|
|
24
24
|
- [@benjamn](https://github.com/benjamn)
|
|
25
|
+
- [@alessbell](https://github.com/alessbell)
|
|
25
26
|
- [@hwillson](https://github.com/hwillson)
|
|
26
27
|
- [@jpvajda](https://github.com/jpvajda)
|
|
27
28
|
|
package/apollo-client.cjs
CHANGED
|
@@ -1298,7 +1298,7 @@ var concat = ApolloLink.concat;
|
|
|
1298
1298
|
|
|
1299
1299
|
var execute = ApolloLink.execute;
|
|
1300
1300
|
|
|
1301
|
-
var version = '3.7.0-beta.
|
|
1301
|
+
var version = '3.7.0-beta.6';
|
|
1302
1302
|
|
|
1303
1303
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1304
1304
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -4231,7 +4231,8 @@ var ObservableQuery = (function (_super) {
|
|
|
4231
4231
|
ObservableQuery.prototype.applyNextFetchPolicy = function (reason, options) {
|
|
4232
4232
|
if (options.nextFetchPolicy) {
|
|
4233
4233
|
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;
|
|
4234
|
-
if (
|
|
4234
|
+
if (fetchPolicy === "standby") ;
|
|
4235
|
+
else if (typeof options.nextFetchPolicy === "function") {
|
|
4235
4236
|
options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {
|
|
4236
4237
|
reason: reason,
|
|
4237
4238
|
options: options,
|
|
@@ -4320,7 +4321,8 @@ var ObservableQuery = (function (_super) {
|
|
|
4320
4321
|
if (newOptions &&
|
|
4321
4322
|
newOptions.variables &&
|
|
4322
4323
|
!equality.equal(newOptions.variables, oldVariables) &&
|
|
4323
|
-
|
|
4324
|
+
options.fetchPolicy !== "standby" &&
|
|
4325
|
+
options.fetchPolicy === oldFetchPolicy) {
|
|
4324
4326
|
this.applyNextFetchPolicy("variables-changed", options);
|
|
4325
4327
|
if (newNetworkStatus === void 0) {
|
|
4326
4328
|
newNetworkStatus = exports.NetworkStatus.setVariables;
|
|
@@ -5570,20 +5572,23 @@ var QueryManager = (function () {
|
|
|
5570
5572
|
});
|
|
5571
5573
|
var fromVariables = function (variables) {
|
|
5572
5574
|
normalized.variables = variables;
|
|
5573
|
-
|
|
5575
|
+
var concastSources = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
5576
|
+
if (normalized.fetchPolicy !== "standby" &&
|
|
5577
|
+
concastSources.length > 0 &&
|
|
5578
|
+
queryInfo.observableQuery) {
|
|
5579
|
+
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
5580
|
+
}
|
|
5581
|
+
return concastSources;
|
|
5574
5582
|
};
|
|
5583
|
+
var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };
|
|
5575
5584
|
this.fetchCancelFns.set(queryId, function (reason) {
|
|
5585
|
+
cleanupCancelFn();
|
|
5576
5586
|
setTimeout(function () { return concast.cancel(reason); });
|
|
5577
5587
|
});
|
|
5578
5588
|
var concast = new Concast(this.transform(normalized.query).hasClientExports
|
|
5579
5589
|
? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)
|
|
5580
5590
|
: fromVariables(normalized.variables));
|
|
5581
|
-
concast.
|
|
5582
|
-
_this.fetchCancelFns.delete(queryId);
|
|
5583
|
-
if (queryInfo.observableQuery) {
|
|
5584
|
-
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
5585
|
-
}
|
|
5586
|
-
});
|
|
5591
|
+
concast.promise.then(cleanupCancelFn, cleanupCancelFn);
|
|
5587
5592
|
return concast;
|
|
5588
5593
|
};
|
|
5589
5594
|
QueryManager.prototype.refetchQueries = function (_a) {
|
|
@@ -6411,13 +6416,18 @@ var InternalState = (function () {
|
|
|
6411
6416
|
this.handleErrorOrCompleted(nextResult);
|
|
6412
6417
|
};
|
|
6413
6418
|
InternalState.prototype.handleErrorOrCompleted = function (result) {
|
|
6419
|
+
var _this = this;
|
|
6414
6420
|
if (!result.loading) {
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
+
Promise.resolve().then(function () {
|
|
6422
|
+
if (result.error) {
|
|
6423
|
+
_this.onError(result.error);
|
|
6424
|
+
}
|
|
6425
|
+
else if (result.data) {
|
|
6426
|
+
_this.onCompleted(result.data);
|
|
6427
|
+
}
|
|
6428
|
+
}).catch(function (error) {
|
|
6429
|
+
__DEV__ && tsInvariant.invariant.warn(error);
|
|
6430
|
+
});
|
|
6421
6431
|
}
|
|
6422
6432
|
};
|
|
6423
6433
|
InternalState.prototype.getCurrentResult = function () {
|