@apollo/client 3.6.6 → 3.6.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/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) (Apollo)
25
- - [@brainkim](https://github.com/brainkim) (Apollo)
26
- - [@jcreighton](https://github.com/jcreighton) (Netflix)
27
- - [@hwillson](https://github.com/hwillson) (Apollo)
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
@@ -1300,7 +1300,7 @@ var concat = ApolloLink.concat;
1300
1300
 
1301
1301
  var execute = ApolloLink.execute;
1302
1302
 
1303
- var version = '3.6.6';
1303
+ var version = '3.6.9';
1304
1304
 
1305
1305
  var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
1306
1306
  function parseAndCheckHttpResponse(operations) {
@@ -3119,7 +3119,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
3119
3119
  cache: policies.cache,
3120
3120
  canRead: canRead,
3121
3121
  readField: function () {
3122
- return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, context), context);
3122
+ return policies.readField(normalizeReadFieldOptions(arguments, objectOrReference, variables), context);
3123
3123
  },
3124
3124
  mergeObjects: makeMergeObjectsFunction(context.store),
3125
3125
  };
@@ -4223,7 +4223,8 @@ var ObservableQuery = (function (_super) {
4223
4223
  ObservableQuery.prototype.applyNextFetchPolicy = function (reason, options) {
4224
4224
  if (options.nextFetchPolicy) {
4225
4225
  var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;
4226
- if (typeof options.nextFetchPolicy === "function") {
4226
+ if (fetchPolicy === "standby") ;
4227
+ else if (typeof options.nextFetchPolicy === "function") {
4227
4228
  options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {
4228
4229
  reason: reason,
4229
4230
  options: options,
@@ -4312,7 +4313,8 @@ var ObservableQuery = (function (_super) {
4312
4313
  if (newOptions &&
4313
4314
  newOptions.variables &&
4314
4315
  !equality.equal(newOptions.variables, oldVariables) &&
4315
- (!newOptions.fetchPolicy || newOptions.fetchPolicy === oldFetchPolicy)) {
4316
+ options.fetchPolicy !== "standby" &&
4317
+ options.fetchPolicy === oldFetchPolicy) {
4316
4318
  this.applyNextFetchPolicy("variables-changed", options);
4317
4319
  if (newNetworkStatus === void 0) {
4318
4320
  newNetworkStatus = exports.NetworkStatus.setVariables;
@@ -4331,7 +4333,7 @@ var ObservableQuery = (function (_super) {
4331
4333
  };
4332
4334
  if (!useDisposableConcast) {
4333
4335
  if (this.concast && this.observer) {
4334
- this.concast.removeObserver(this.observer, true);
4336
+ this.concast.removeObserver(this.observer);
4335
4337
  }
4336
4338
  this.concast = concast;
4337
4339
  this.observer = observer;
@@ -5561,20 +5563,23 @@ var QueryManager = (function () {
5561
5563
  });
5562
5564
  var fromVariables = function (variables) {
5563
5565
  normalized.variables = variables;
5564
- return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
5566
+ var concastSources = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
5567
+ if (normalized.fetchPolicy !== "standby" &&
5568
+ concastSources.length > 0 &&
5569
+ queryInfo.observableQuery) {
5570
+ queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
5571
+ }
5572
+ return concastSources;
5565
5573
  };
5574
+ var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };
5566
5575
  this.fetchCancelFns.set(queryId, function (reason) {
5576
+ cleanupCancelFn();
5567
5577
  setTimeout(function () { return concast.cancel(reason); });
5568
5578
  });
5569
5579
  var concast = new Concast(this.transform(normalized.query).hasClientExports
5570
5580
  ? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)
5571
5581
  : fromVariables(normalized.variables));
5572
- concast.cleanup(function () {
5573
- _this.fetchCancelFns.delete(queryId);
5574
- if (queryInfo.observableQuery) {
5575
- queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
5576
- }
5577
- });
5582
+ concast.promise.then(cleanupCancelFn, cleanupCancelFn);
5578
5583
  return concast;
5579
5584
  };
5580
5585
  QueryManager.prototype.refetchQueries = function (_a) {
@@ -6422,7 +6427,7 @@ var InternalState = (function () {
6422
6427
  if (queryResult)
6423
6428
  return queryResult;
6424
6429
  var data = result.data; result.partial; var resultWithoutPartial = tslib.__rest(result, ["data", "partial"]);
6425
- 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: true, previousData: this.previousData }));
6430
+ 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 }));
6426
6431
  if (!queryResult.error && isNonEmptyArray(result.errors)) {
6427
6432
  queryResult.error = new ApolloError({ graphQLErrors: result.errors });
6428
6433
  }