@apollo/client 3.7.0-beta.3 → 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 +5 -5
- package/apollo-client.cjs +28 -18
- 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/policies.js +1 -1
- package/cache/inmemory/policies.js.map +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/link/batch/batch.cjs +2 -5
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +2 -5
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +2 -5
- package/link/batch/batching.js.map +1 -1
- package/package.json +13 -13
- package/react/hooks/hooks.cjs +12 -7
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +12 -7
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +12 -7
- 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
|
@@ -19,12 +19,12 @@ The Apollo Client API reference can be found at: <br/>
|
|
|
19
19
|
Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apollo's official learning platform: <br/>
|
|
20
20
|
[https://odyssey.apollographql.com/](https://odyssey.apollographql.com/)
|
|
21
21
|
|
|
22
|
-
## Maintainers
|
|
22
|
+
## Apollo Maintainers
|
|
23
23
|
|
|
24
|
-
- [@benjamn](https://github.com/benjamn)
|
|
25
|
-
- [@
|
|
26
|
-
- [@
|
|
27
|
-
- [@
|
|
24
|
+
- [@benjamn](https://github.com/benjamn)
|
|
25
|
+
- [@alessbell](https://github.com/alessbell)
|
|
26
|
+
- [@hwillson](https://github.com/hwillson)
|
|
27
|
+
- [@jpvajda](https://github.com/jpvajda)
|
|
28
28
|
|
|
29
29
|
## Who is Apollo?
|
|
30
30
|
|
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) {
|
|
@@ -3127,7 +3127,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
3127
3127
|
cache: policies.cache,
|
|
3128
3128
|
canRead: canRead,
|
|
3129
3129
|
readField: function () {
|
|
3130
|
-
return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference,
|
|
3130
|
+
return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context);
|
|
3131
3131
|
},
|
|
3132
3132
|
mergeObjects: makeMergeObjectsFunction(context.store),
|
|
3133
3133
|
};
|
|
@@ -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 () {
|
|
@@ -6431,7 +6441,7 @@ var InternalState = (function () {
|
|
|
6431
6441
|
if (queryResult)
|
|
6432
6442
|
return queryResult;
|
|
6433
6443
|
var data = result.data; result.partial; var resultWithoutPartial = tslib.__rest(result, ["data", "partial"]);
|
|
6434
|
-
this.toQueryResultCache.set(result, queryResult = tslib.__assign(tslib.__assign(tslib.__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called:
|
|
6444
|
+
this.toQueryResultCache.set(result, queryResult = tslib.__assign(tslib.__assign(tslib.__assign({ data: data }, resultWithoutPartial), this.obsQueryFields), { client: this.client, observable: this.observable, variables: this.observable.variables, called: !this.queryHookOptions.skip, previousData: this.previousData }));
|
|
6435
6445
|
if (!queryResult.error && isNonEmptyArray(result.errors)) {
|
|
6436
6446
|
queryResult.error = new ApolloError({ graphQLErrors: result.errors });
|
|
6437
6447
|
}
|