@apollo/client 3.11.2 → 3.11.4

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/apollo-client.cjs +109 -87
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/core/types/common.d.ts +5 -3
  6. package/cache/core/types/common.js.map +1 -1
  7. package/cache/inmemory/entityStore.js.map +1 -1
  8. package/core/ObservableQuery.d.ts +1 -1
  9. package/core/ObservableQuery.js +79 -43
  10. package/core/ObservableQuery.js.map +1 -1
  11. package/core/QueryManager.js +19 -11
  12. package/core/QueryManager.js.map +1 -1
  13. package/core/core.cjs +65 -43
  14. package/core/core.cjs.map +1 -1
  15. package/core/core.cjs.native.js +65 -43
  16. package/dev/dev.cjs +72 -67
  17. package/dev/dev.cjs.map +1 -1
  18. package/dev/dev.cjs.native.js +72 -67
  19. package/invariantErrorCodes.js +72 -66
  20. package/link/core/ApolloLink.js +2 -2
  21. package/link/core/core.cjs +2 -2
  22. package/link/core/core.cjs.map +1 -1
  23. package/link/core/core.cjs.native.js +2 -2
  24. package/link/http/checkFetcher.js +1 -1
  25. package/link/http/createHttpLink.js +1 -1
  26. package/link/http/http.cjs +3 -3
  27. package/link/http/http.cjs.map +1 -1
  28. package/link/http/http.cjs.native.js +3 -3
  29. package/link/http/serializeFetchParameter.js +1 -1
  30. package/link/persisted-queries/index.js +2 -2
  31. package/link/persisted-queries/persisted-queries.cjs +2 -2
  32. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  33. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  34. package/link/utils/toPromise.js +1 -1
  35. package/link/utils/utils.cjs +2 -2
  36. package/link/utils/utils.cjs.map +1 -1
  37. package/link/utils/utils.cjs.native.js +2 -2
  38. package/link/utils/validateOperation.js +1 -1
  39. package/package.json +1 -1
  40. package/react/context/ApolloConsumer.js +1 -1
  41. package/react/context/ApolloContext.js +1 -1
  42. package/react/context/ApolloProvider.js +1 -1
  43. package/react/context/context.cjs +3 -3
  44. package/react/context/context.cjs.map +1 -1
  45. package/react/context/context.cjs.native.js +3 -3
  46. package/react/hoc/hoc-utils.js +1 -1
  47. package/react/hoc/hoc.cjs +2 -2
  48. package/react/hoc/hoc.cjs.map +1 -1
  49. package/react/hoc/hoc.cjs.native.js +2 -2
  50. package/react/hoc/withApollo.js +1 -1
  51. package/react/hooks/hooks.cjs +9 -9
  52. package/react/hooks/hooks.cjs.map +1 -1
  53. package/react/hooks/hooks.cjs.native.js +9 -9
  54. package/react/hooks/useApolloClient.js +1 -1
  55. package/react/hooks/useLoadableQuery.js +2 -2
  56. package/react/hooks/useSubscription.js +3 -3
  57. package/react/hooks/useSuspenseQuery.js +2 -2
  58. package/react/hooks/useSyncExternalStore.js +1 -1
  59. package/react/internal/cache/QueryReference.js +1 -1
  60. package/react/internal/internal.cjs +2 -2
  61. package/react/internal/internal.cjs.map +1 -1
  62. package/react/internal/internal.cjs.native.js +2 -2
  63. package/react/parser/index.js +5 -5
  64. package/react/parser/parser.cjs +5 -5
  65. package/react/parser/parser.cjs.map +1 -1
  66. package/react/parser/parser.cjs.native.js +5 -5
  67. package/testing/core/core.cjs +2 -2
  68. package/testing/core/core.cjs.map +1 -1
  69. package/testing/core/core.cjs.native.js +2 -2
  70. package/testing/core/mocking/mockLink.js +2 -2
  71. package/testing/internal/scenarios/index.d.ts +5 -0
  72. package/testing/internal/scenarios/index.js +1 -1
  73. package/testing/internal/scenarios/index.js.map +1 -1
  74. package/utilities/globals/globals.cjs +1 -1
  75. package/utilities/globals/globals.cjs.map +1 -1
  76. package/utilities/globals/globals.cjs.native.js +1 -1
  77. package/utilities/graphql/DocumentTransform.js +1 -1
  78. package/utilities/graphql/directives.js +4 -4
  79. package/utilities/graphql/fragments.js +3 -3
  80. package/utilities/graphql/getFromAST.js +8 -8
  81. package/utilities/graphql/storeUtils.js +1 -1
  82. package/utilities/graphql/transform.js +2 -2
  83. package/utilities/observables/Concast.js +1 -1
  84. package/utilities/observables/Concast.js.map +1 -1
  85. package/utilities/utilities.cjs +20 -20
  86. package/utilities/utilities.cjs.map +1 -1
  87. package/utilities/utilities.cjs.native.js +20 -20
  88. package/version.js +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.11.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#11994](https://github.com/apollographql/apollo-client/pull/11994) [`41b17e5`](https://github.com/apollographql/apollo-client/commit/41b17e5950f4db5ef9e32ded5bb327b3bf19e6e8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Update the `Modifier` function type to allow `cache.modify` to return deeply partial data.
8
+
9
+ - [#11989](https://github.com/apollographql/apollo-client/pull/11989) [`e609156`](https://github.com/apollographql/apollo-client/commit/e609156c4989def88ae1a28b2e0f0378077a5528) Thanks [@phryneas](https://github.com/phryneas)! - Fix a potential crash when calling `clearStore` while a query was running.
10
+
11
+ Previously, calling `client.clearStore()` while a query was running had one of these results:
12
+
13
+ - `useQuery` would stay in a `loading: true` state.
14
+ - `useLazyQuery` would stay in a `loading: true` state, but also crash with a `"Cannot read property 'data' of undefined"` error.
15
+
16
+ Now, in both cases, the hook will enter an error state with a `networkError`, and the promise returned by the `useLazyQuery` `execute` function will return a result in an error state.
17
+
18
+ - [#11994](https://github.com/apollographql/apollo-client/pull/11994) [`41b17e5`](https://github.com/apollographql/apollo-client/commit/41b17e5950f4db5ef9e32ded5bb327b3bf19e6e8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent accidental distribution on `cache.modify` field modifiers when a field is a union type array.
19
+
20
+ ## 3.11.3
21
+
22
+ ### Patch Changes
23
+
24
+ - [#11984](https://github.com/apollographql/apollo-client/pull/11984) [`5db1659`](https://github.com/apollographql/apollo-client/commit/5db1659dc07e3de697894fc1c6f00a151d068291) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where multiple fetches with results that returned errors would sometimes set the `data` property with an `errorPolicy` of `none`.
25
+
26
+ - [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where `fetchMore` would write its result data to the cache when using it with a `no-cache` fetch policy.
27
+
28
+ - [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where executing `fetchMore` with a `no-cache` fetch policy could sometimes result in multiple network requests.
29
+
30
+ - [#11974](https://github.com/apollographql/apollo-client/pull/11974) [`c95848e`](https://github.com/apollographql/apollo-client/commit/c95848e859fb7ce0b3b9439ac71dff880f991450) Thanks [@jerelmiller](https://github.com/jerelmiller)! -
31
+
32
+ #### Potentially disruptive change
33
+
34
+ When calling `fetchMore` with a query that has a `no-cache` fetch policy, `fetchMore` will now throw if an `updateQuery` function is not provided. This provides a mechanism to merge the results from the `fetchMore` call with the query's previous result.
35
+
3
36
  ## 3.11.2
4
37
 
5
38
  ### Patch Changes
package/apollo-client.cjs CHANGED
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
31
31
  var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
32
32
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
33
 
34
- var version = "3.11.2";
34
+ var version = "3.11.4";
35
35
 
36
36
  function maybe(thunk) {
37
37
  try {
@@ -145,7 +145,7 @@ function shouldInclude(_a, variables) {
145
145
  if (ifArgument.value.kind === "Variable") {
146
146
  evaledValue =
147
147
  variables && variables[ifArgument.value.name.value];
148
- invariant(evaledValue !== void 0, 69, directive.name.value);
148
+ invariant(evaledValue !== void 0, 70, directive.name.value);
149
149
  }
150
150
  else {
151
151
  evaledValue = ifArgument.value.value;
@@ -180,12 +180,12 @@ function getInclusionDirectives(directives) {
180
180
  return;
181
181
  var directiveArguments = directive.arguments;
182
182
  var directiveName = directive.name.value;
183
- invariant(directiveArguments && directiveArguments.length === 1, 70, directiveName);
183
+ invariant(directiveArguments && directiveArguments.length === 1, 71, directiveName);
184
184
  var ifArgument = directiveArguments[0];
185
- invariant(ifArgument.name && ifArgument.name.value === "if", 71, directiveName);
185
+ invariant(ifArgument.name && ifArgument.name.value === "if", 72, directiveName);
186
186
  var ifValue = ifArgument.value;
187
187
  invariant(ifValue &&
188
- (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 72, directiveName);
188
+ (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 73, directiveName);
189
189
  result.push({ directive: directive, ifArgument: ifArgument });
190
190
  });
191
191
  }
@@ -213,7 +213,7 @@ function getFragmentQueryDocument(document, fragmentName) {
213
213
  document.definitions.forEach(function (definition) {
214
214
  if (definition.kind === "OperationDefinition") {
215
215
  throw newInvariantError(
216
- 73,
216
+ 74,
217
217
  definition.operation,
218
218
  definition.name ? " named '".concat(definition.name.value, "'") : ""
219
219
  );
@@ -223,7 +223,7 @@ function getFragmentQueryDocument(document, fragmentName) {
223
223
  }
224
224
  });
225
225
  if (typeof actualFragmentName === "undefined") {
226
- invariant(fragments.length === 1, 74, fragments.length);
226
+ invariant(fragments.length === 1, 75, fragments.length);
227
227
  actualFragmentName = fragments[0].name.value;
228
228
  }
229
229
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -264,7 +264,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
264
264
  return fragmentMap(fragmentName);
265
265
  }
266
266
  var fragment = fragmentMap && fragmentMap[fragmentName];
267
- invariant(fragment, 75, fragmentName);
267
+ invariant(fragment, 76, fragmentName);
268
268
  return fragment || null;
269
269
  }
270
270
  default:
@@ -515,7 +515,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
515
515
  argObj[name.value] = null;
516
516
  }
517
517
  else {
518
- throw newInvariantError(84, name.value, value.kind);
518
+ throw newInvariantError(85, name.value, value.kind);
519
519
  }
520
520
  }
521
521
  function storeKeyNameFromField(field, variables) {
@@ -649,16 +649,16 @@ function isInlineFragment(selection) {
649
649
  }
650
650
 
651
651
  function checkDocument(doc) {
652
- invariant(doc && doc.kind === "Document", 76);
652
+ invariant(doc && doc.kind === "Document", 77);
653
653
  var operations = doc.definitions
654
654
  .filter(function (d) { return d.kind !== "FragmentDefinition"; })
655
655
  .map(function (definition) {
656
656
  if (definition.kind !== "OperationDefinition") {
657
- throw newInvariantError(77, definition.kind);
657
+ throw newInvariantError(78, definition.kind);
658
658
  }
659
659
  return definition;
660
660
  });
661
- invariant(operations.length <= 1, 78, operations.length);
661
+ invariant(operations.length <= 1, 79, operations.length);
662
662
  return doc;
663
663
  }
664
664
  function getOperationDefinition(doc) {
@@ -681,14 +681,14 @@ function getFragmentDefinitions(doc) {
681
681
  }
682
682
  function getQueryDefinition(doc) {
683
683
  var queryDef = getOperationDefinition(doc);
684
- invariant(queryDef && queryDef.operation === "query", 79);
684
+ invariant(queryDef && queryDef.operation === "query", 80);
685
685
  return queryDef;
686
686
  }
687
687
  function getFragmentDefinition(doc) {
688
- invariant(doc.kind === "Document", 80);
689
- invariant(doc.definitions.length <= 1, 81);
688
+ invariant(doc.kind === "Document", 81);
689
+ invariant(doc.definitions.length <= 1, 82);
690
690
  var fragmentDef = doc.definitions[0];
691
- invariant(fragmentDef.kind === "FragmentDefinition", 82);
691
+ invariant(fragmentDef.kind === "FragmentDefinition", 83);
692
692
  return fragmentDef;
693
693
  }
694
694
  function getMainDefinition(queryDoc) {
@@ -711,7 +711,7 @@ function getMainDefinition(queryDoc) {
711
711
  if (fragmentDefinition) {
712
712
  return fragmentDefinition;
713
713
  }
714
- throw newInvariantError(83);
714
+ throw newInvariantError(84);
715
715
  }
716
716
  function getDefaultValues(definition) {
717
717
  var defaultValues = Object.create(null);
@@ -762,7 +762,7 @@ var DocumentTransform = (function () {
762
762
  makeCacheKey: function (document) {
763
763
  var cacheKeys = _this.getCacheKey(document);
764
764
  if (cacheKeys) {
765
- invariant(Array.isArray(cacheKeys), 68);
765
+ invariant(Array.isArray(cacheKeys), 69);
766
766
  return stableCacheKeys_1.lookupArray(cacheKeys);
767
767
  }
768
768
  },
@@ -892,7 +892,7 @@ function removeDirectivesFromDocument(directives, doc) {
892
892
  return getInUseByFragmentName(ancestor.name.value);
893
893
  }
894
894
  }
895
- globalThis.__DEV__ !== false && invariant.error(85);
895
+ globalThis.__DEV__ !== false && invariant.error(86);
896
896
  return null;
897
897
  };
898
898
  var operationCount = 0;
@@ -1396,7 +1396,7 @@ var Concast = (function (_super) {
1396
1396
  _this.cancel = function (reason) {
1397
1397
  _this.reject(reason);
1398
1398
  _this.sources = [];
1399
- _this.handlers.complete();
1399
+ _this.handlers.error(reason);
1400
1400
  };
1401
1401
  _this.promise.catch(function (_) { });
1402
1402
  if (typeof sources === "function") {
@@ -1546,7 +1546,7 @@ function toPromise(observable) {
1546
1546
  observable.subscribe({
1547
1547
  next: function (data) {
1548
1548
  if (completed) {
1549
- globalThis.__DEV__ !== false && invariant.warn(42);
1549
+ globalThis.__DEV__ !== false && invariant.warn(43);
1550
1550
  }
1551
1551
  else {
1552
1552
  completed = true;
@@ -1589,7 +1589,7 @@ function validateOperation(operation) {
1589
1589
  for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
1590
1590
  var key = _a[_i];
1591
1591
  if (OPERATION_FIELDS.indexOf(key) < 0) {
1592
- throw newInvariantError(43, key);
1592
+ throw newInvariantError(44, key);
1593
1593
  }
1594
1594
  }
1595
1595
  return operation;
@@ -1698,7 +1698,7 @@ var ApolloLink = (function () {
1698
1698
  ApolloLink.concat = function (first, second) {
1699
1699
  var firstLink = toLink(first);
1700
1700
  if (isTerminating(firstLink)) {
1701
- globalThis.__DEV__ !== false && invariant.warn(35, firstLink);
1701
+ globalThis.__DEV__ !== false && invariant.warn(36, firstLink);
1702
1702
  return firstLink;
1703
1703
  }
1704
1704
  var nextLink = toLink(second);
@@ -1724,7 +1724,7 @@ var ApolloLink = (function () {
1724
1724
  return ApolloLink.concat(this, next);
1725
1725
  };
1726
1726
  ApolloLink.prototype.request = function (operation, forward) {
1727
- throw newInvariantError(36);
1727
+ throw newInvariantError(37);
1728
1728
  };
1729
1729
  ApolloLink.prototype.onError = function (error, observer) {
1730
1730
  if (observer && observer.error) {
@@ -2106,7 +2106,7 @@ var serializeFetchParameter = function (p, label) {
2106
2106
  serialized = JSON.stringify(p);
2107
2107
  }
2108
2108
  catch (e) {
2109
- var parseError = newInvariantError(39, label, e.message);
2109
+ var parseError = newInvariantError(40, label, e.message);
2110
2110
  parseError.parseError = e;
2111
2111
  throw parseError;
2112
2112
  }
@@ -2192,7 +2192,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
2192
2192
 
2193
2193
  var checkFetcher = function (fetcher) {
2194
2194
  if (!fetcher && typeof fetch === "undefined") {
2195
- throw newInvariantError(37);
2195
+ throw newInvariantError(38);
2196
2196
  }
2197
2197
  };
2198
2198
 
@@ -2326,7 +2326,7 @@ var createHttpLink = function (linkOptions) {
2326
2326
  options.headers = options.headers || {};
2327
2327
  var acceptHeader = "multipart/mixed;";
2328
2328
  if (isSubscription && hasDefer) {
2329
- globalThis.__DEV__ !== false && invariant.warn(38);
2329
+ globalThis.__DEV__ !== false && invariant.warn(39);
2330
2330
  }
2331
2331
  if (isSubscription) {
2332
2332
  acceptHeader +=
@@ -5095,6 +5095,11 @@ var ObservableQuery = (function (_super) {
5095
5095
  this.observe();
5096
5096
  }
5097
5097
  var updatedQuerySet = new Set();
5098
+ var updateQuery = fetchMoreOptions === null || fetchMoreOptions === void 0 ? void 0 : fetchMoreOptions.updateQuery;
5099
+ var isCached = this.options.fetchPolicy !== "no-cache";
5100
+ if (!isCached) {
5101
+ invariant(updateQuery, 21);
5102
+ }
5098
5103
  return this.queryManager
5099
5104
  .fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore)
5100
5105
  .then(function (fetchMoreResult) {
@@ -5102,38 +5107,48 @@ var ObservableQuery = (function (_super) {
5102
5107
  if (queryInfo.networkStatus === exports.NetworkStatus.fetchMore) {
5103
5108
  queryInfo.networkStatus = originalNetworkStatus;
5104
5109
  }
5105
- _this.queryManager.cache.batch({
5106
- update: function (cache) {
5107
- var updateQuery = fetchMoreOptions.updateQuery;
5108
- if (updateQuery) {
5109
- cache.updateQuery({
5110
- query: _this.query,
5111
- variables: _this.variables,
5112
- returnPartialData: true,
5113
- optimistic: false,
5114
- }, function (previous) {
5115
- return updateQuery(previous, {
5116
- fetchMoreResult: fetchMoreResult.data,
5110
+ if (isCached) {
5111
+ _this.queryManager.cache.batch({
5112
+ update: function (cache) {
5113
+ var updateQuery = fetchMoreOptions.updateQuery;
5114
+ if (updateQuery) {
5115
+ cache.updateQuery({
5116
+ query: _this.query,
5117
+ variables: _this.variables,
5118
+ returnPartialData: true,
5119
+ optimistic: false,
5120
+ }, function (previous) {
5121
+ return updateQuery(previous, {
5122
+ fetchMoreResult: fetchMoreResult.data,
5123
+ variables: combinedOptions.variables,
5124
+ });
5125
+ });
5126
+ }
5127
+ else {
5128
+ cache.writeQuery({
5129
+ query: combinedOptions.query,
5117
5130
  variables: combinedOptions.variables,
5131
+ data: fetchMoreResult.data,
5118
5132
  });
5119
- });
5120
- }
5121
- else {
5122
- cache.writeQuery({
5123
- query: combinedOptions.query,
5124
- variables: combinedOptions.variables,
5125
- data: fetchMoreResult.data,
5126
- });
5127
- }
5128
- },
5129
- onWatchUpdated: function (watch) {
5130
- updatedQuerySet.add(watch.query);
5131
- },
5132
- });
5133
+ }
5134
+ },
5135
+ onWatchUpdated: function (watch) {
5136
+ updatedQuerySet.add(watch.query);
5137
+ },
5138
+ });
5139
+ }
5140
+ else {
5141
+ var lastResult = _this.getLast("result");
5142
+ var data = updateQuery(lastResult.data, {
5143
+ fetchMoreResult: fetchMoreResult.data,
5144
+ variables: combinedOptions.variables,
5145
+ });
5146
+ _this.reportResult(tslib.__assign(tslib.__assign({}, lastResult), { data: data }), _this.variables);
5147
+ }
5133
5148
  return fetchMoreResult;
5134
5149
  })
5135
5150
  .finally(function () {
5136
- if (!updatedQuerySet.has(_this.query)) {
5151
+ if (isCached && !updatedQuerySet.has(_this.query)) {
5137
5152
  reobserveCacheFirst(_this);
5138
5153
  }
5139
5154
  });
@@ -5164,7 +5179,7 @@ var ObservableQuery = (function (_super) {
5164
5179
  options.onError(err);
5165
5180
  return;
5166
5181
  }
5167
- globalThis.__DEV__ !== false && invariant.error(21, err);
5182
+ globalThis.__DEV__ !== false && invariant.error(22, err);
5168
5183
  },
5169
5184
  });
5170
5185
  this.subscriptions.add(subscription);
@@ -5264,7 +5279,7 @@ var ObservableQuery = (function (_super) {
5264
5279
  if (pollingInfo && pollingInfo.interval === pollInterval) {
5265
5280
  return;
5266
5281
  }
5267
- invariant(pollInterval, 22);
5282
+ invariant(pollInterval, 23);
5268
5283
  var info = pollingInfo || (this.pollingInfo = {});
5269
5284
  info.interval = pollInterval;
5270
5285
  var maybeFetch = function () {
@@ -5348,6 +5363,9 @@ var ObservableQuery = (function (_super) {
5348
5363
  },
5349
5364
  error: function (error) {
5350
5365
  if (equal.equal(_this.variables, variables)) {
5366
+ if (!isApolloError(error)) {
5367
+ error = new ApolloError({ networkError: error });
5368
+ }
5351
5369
  finishWaitingForOwnResult();
5352
5370
  _this.reportError(error, variables);
5353
5371
  }
@@ -5438,11 +5456,11 @@ function reobserveCacheFirst(obsQuery) {
5438
5456
  return obsQuery.reobserve();
5439
5457
  }
5440
5458
  function defaultSubscriptionObserverErrorCallback(error) {
5441
- globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack);
5459
+ globalThis.__DEV__ !== false && invariant.error(24, error.message, error.stack);
5442
5460
  }
5443
5461
  function logMissingFieldErrors(missing) {
5444
5462
  if (globalThis.__DEV__ !== false && missing) {
5445
- globalThis.__DEV__ !== false && invariant.debug(24, missing);
5463
+ globalThis.__DEV__ !== false && invariant.debug(25, missing);
5446
5464
  }
5447
5465
  }
5448
5466
  function skipCacheDataFor(fetchPolicy ) {
@@ -5770,7 +5788,7 @@ var QueryManager = (function () {
5770
5788
  this.queries.forEach(function (_info, queryId) {
5771
5789
  _this.stopQueryNoBroadcast(queryId);
5772
5790
  });
5773
- this.cancelPendingFetches(newInvariantError(25));
5791
+ this.cancelPendingFetches(newInvariantError(26));
5774
5792
  };
5775
5793
  QueryManager.prototype.cancelPendingFetches = function (error) {
5776
5794
  this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
@@ -5784,8 +5802,8 @@ var QueryManager = (function () {
5784
5802
  return tslib.__generator(this, function (_j) {
5785
5803
  switch (_j.label) {
5786
5804
  case 0:
5787
- invariant(mutation, 26);
5788
- invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
5805
+ invariant(mutation, 27);
5806
+ invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 28);
5789
5807
  mutationId = this.generateMutationId();
5790
5808
  mutation = this.cache.transformForLink(this.transform(mutation));
5791
5809
  hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
@@ -6107,10 +6125,10 @@ var QueryManager = (function () {
6107
6125
  QueryManager.prototype.query = function (options, queryId) {
6108
6126
  var _this = this;
6109
6127
  if (queryId === void 0) { queryId = this.generateQueryId(); }
6110
- invariant(options.query, 28);
6111
- invariant(options.query.kind === "Document", 29);
6112
- invariant(!options.returnPartialData, 30);
6113
- invariant(!options.pollInterval, 31);
6128
+ invariant(options.query, 29);
6129
+ invariant(options.query.kind === "Document", 30);
6130
+ invariant(!options.returnPartialData, 31);
6131
+ invariant(!options.pollInterval, 32);
6114
6132
  return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
6115
6133
  };
6116
6134
  QueryManager.prototype.generateQueryId = function () {
@@ -6135,7 +6153,7 @@ var QueryManager = (function () {
6135
6153
  if (options === void 0) { options = {
6136
6154
  discardWatches: true,
6137
6155
  }; }
6138
- this.cancelPendingFetches(newInvariantError(32));
6156
+ this.cancelPendingFetches(newInvariantError(33));
6139
6157
  this.queries.forEach(function (queryInfo) {
6140
6158
  if (queryInfo.observableQuery) {
6141
6159
  queryInfo.networkStatus = exports.NetworkStatus.loading;
@@ -6211,7 +6229,7 @@ var QueryManager = (function () {
6211
6229
  if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
6212
6230
  queryNamesAndDocs.forEach(function (included, nameOrDoc) {
6213
6231
  if (!included) {
6214
- globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
6232
+ globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 34 : 35, nameOrDoc);
6215
6233
  }
6216
6234
  });
6217
6235
  }
@@ -6369,8 +6387,9 @@ var QueryManager = (function () {
6369
6387
  return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
6370
6388
  var graphQLErrors = getGraphQLErrorsFromResult(result);
6371
6389
  var hasErrors = graphQLErrors.length > 0;
6390
+ var errorPolicy = options.errorPolicy;
6372
6391
  if (requestId >= queryInfo.lastRequestId) {
6373
- if (hasErrors && options.errorPolicy === "none") {
6392
+ if (hasErrors && errorPolicy === "none") {
6374
6393
  throw queryInfo.markError(new ApolloError({
6375
6394
  graphQLErrors: graphQLErrors,
6376
6395
  }));
@@ -6383,7 +6402,10 @@ var QueryManager = (function () {
6383
6402
  loading: false,
6384
6403
  networkStatus: exports.NetworkStatus.ready,
6385
6404
  };
6386
- if (hasErrors && options.errorPolicy !== "ignore") {
6405
+ if (hasErrors && errorPolicy === "none") {
6406
+ aqr.data = void 0;
6407
+ }
6408
+ if (hasErrors && errorPolicy !== "ignore") {
6387
6409
  aqr.errors = graphQLErrors;
6388
6410
  aqr.networkStatus = exports.NetworkStatus.error;
6389
6411
  }
@@ -7231,7 +7253,7 @@ if (globalThis.__DEV__ !== false) {
7231
7253
 
7232
7254
  var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
7233
7255
  function getApolloContext() {
7234
- invariant("createContext" in React__namespace, 45);
7256
+ invariant("createContext" in React__namespace, 46);
7235
7257
  var context = React__namespace.createContext[contextKey];
7236
7258
  if (!context) {
7237
7259
  Object.defineProperty(React__namespace.createContext, contextKey, {
@@ -7249,7 +7271,7 @@ var resetApolloContext = getApolloContext;
7249
7271
  var ApolloConsumer = function (props) {
7250
7272
  var ApolloContext = getApolloContext();
7251
7273
  return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
7252
- invariant(context && context.client, 44);
7274
+ invariant(context && context.client, 45);
7253
7275
  return props.children(context.client);
7254
7276
  }));
7255
7277
  };
@@ -7261,14 +7283,14 @@ var ApolloProvider = function (_a) {
7261
7283
  var context = React__namespace.useMemo(function () {
7262
7284
  return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
7263
7285
  }, [parentContext, client]);
7264
- invariant(context.client, 46);
7286
+ invariant(context.client, 47);
7265
7287
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
7266
7288
  };
7267
7289
 
7268
7290
  function useApolloClient(override) {
7269
7291
  var context = React__namespace.useContext(getApolloContext());
7270
7292
  var client = override || context.client;
7271
- invariant(!!client, 49);
7293
+ invariant(!!client, 50);
7272
7294
  return client;
7273
7295
  }
7274
7296
 
@@ -7283,7 +7305,7 @@ var useSyncExternalStore = realHook$1 ||
7283
7305
  !didWarnUncachedGetSnapshot &&
7284
7306
  value !== getSnapshot()) {
7285
7307
  didWarnUncachedGetSnapshot = true;
7286
- globalThis.__DEV__ !== false && invariant.error(59);
7308
+ globalThis.__DEV__ !== false && invariant.error(60);
7287
7309
  }
7288
7310
  var _a = React__namespace.useState({
7289
7311
  inst: { value: value, getSnapshot: getSnapshot },
@@ -7351,7 +7373,7 @@ function parser(document) {
7351
7373
  if (cached)
7352
7374
  return cached;
7353
7375
  var variables, type, name;
7354
- invariant(!!document && !!document.kind, 61, document);
7376
+ invariant(!!document && !!document.kind, 62, document);
7355
7377
  var fragments = [];
7356
7378
  var queries = [];
7357
7379
  var mutations = [];
@@ -7379,10 +7401,10 @@ function parser(document) {
7379
7401
  invariant(!fragments.length ||
7380
7402
  queries.length ||
7381
7403
  mutations.length ||
7382
- subscriptions.length, 62);
7404
+ subscriptions.length, 63);
7383
7405
  invariant(
7384
7406
  queries.length + mutations.length + subscriptions.length <= 1,
7385
- 63,
7407
+ 64,
7386
7408
  document,
7387
7409
  queries.length,
7388
7410
  subscriptions.length,
@@ -7394,7 +7416,7 @@ function parser(document) {
7394
7416
  var definitions = queries.length ? queries
7395
7417
  : mutations.length ? mutations
7396
7418
  : subscriptions;
7397
- invariant(definitions.length === 1, 64, document, definitions.length);
7419
+ invariant(definitions.length === 1, 65, document, definitions.length);
7398
7420
  var definition = definitions[0];
7399
7421
  variables = definition.variableDefinitions || [];
7400
7422
  if (definition.name && definition.name.kind === "Name") {
@@ -7419,7 +7441,7 @@ function verifyDocumentType(document, type) {
7419
7441
  var usedOperationName = operationName(operation.type);
7420
7442
  invariant(
7421
7443
  operation.type === type,
7422
- 65,
7444
+ 66,
7423
7445
  requiredOperationName,
7424
7446
  requiredOperationName,
7425
7447
  usedOperationName
@@ -8000,10 +8022,10 @@ function useSubscription(subscription, options) {
8000
8022
  if (!hasIssuedDeprecationWarningRef.current) {
8001
8023
  hasIssuedDeprecationWarningRef.current = true;
8002
8024
  if (options.onSubscriptionData) {
8003
- globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53);
8025
+ globalThis.__DEV__ !== false && invariant.warn(options.onData ? 53 : 54);
8004
8026
  }
8005
8027
  if (options.onSubscriptionComplete) {
8006
- globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55);
8028
+ globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 55 : 56);
8007
8029
  }
8008
8030
  }
8009
8031
  var skip = options.skip, fetchPolicy = options.fetchPolicy, errorPolicy = options.errorPolicy, shouldResubscribe = options.shouldResubscribe, context = options.context, extensions = options.extensions, ignoreResults = options.ignoreResults;
@@ -8124,7 +8146,7 @@ function useSubscription(subscription, options) {
8124
8146
  : fallbackResult;
8125
8147
  }, function () { return fallbackResult; });
8126
8148
  return React__namespace.useMemo(function () { return (tslib.__assign(tslib.__assign({}, ret), { restart: function () {
8127
- invariant(!optionsRef.current.skip, 56);
8149
+ invariant(!optionsRef.current.skip, 57);
8128
8150
  setObservable(recreateRef.current());
8129
8151
  } })); }, [ret]);
8130
8152
  }
@@ -8226,7 +8248,7 @@ function wrapQueryRef(internalQueryRef) {
8226
8248
  return ref;
8227
8249
  }
8228
8250
  function assertWrappedQueryRef(queryRef) {
8229
- invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 60);
8251
+ invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 61);
8230
8252
  }
8231
8253
  function getWrappedPromise(queryRef) {
8232
8254
  var internalQueryRef = unwrapQueryRef(queryRef);
@@ -8597,11 +8619,11 @@ function validateFetchPolicy(fetchPolicy) {
8597
8619
  "no-cache",
8598
8620
  "cache-and-network",
8599
8621
  ];
8600
- invariant(supportedFetchPolicies.includes(fetchPolicy), 57, fetchPolicy);
8622
+ invariant(supportedFetchPolicies.includes(fetchPolicy), 58, fetchPolicy);
8601
8623
  }
8602
8624
  function validatePartialDataReturn(fetchPolicy, returnPartialData) {
8603
8625
  if (fetchPolicy === "no-cache" && returnPartialData) {
8604
- globalThis.__DEV__ !== false && invariant.warn(58);
8626
+ globalThis.__DEV__ !== false && invariant.warn(59);
8605
8627
  }
8606
8628
  }
8607
8629
  function toApolloError(result) {
@@ -8721,7 +8743,7 @@ function useLoadableQuery(query, options) {
8721
8743
  for (var _i = 0; _i < arguments.length; _i++) {
8722
8744
  args[_i] = arguments[_i];
8723
8745
  }
8724
- invariant(!calledDuringRender(), 50);
8746
+ invariant(!calledDuringRender(), 51);
8725
8747
  var variables = args[0];
8726
8748
  var cacheKey = tslib.__spreadArray([
8727
8749
  query,
@@ -8740,7 +8762,7 @@ function useLoadableQuery(query, options) {
8740
8762
  client,
8741
8763
  ]);
8742
8764
  var subscribeToMore = React__namespace.useCallback(function (options) {
8743
- invariant(internalQueryRef, 51);
8765
+ invariant(internalQueryRef, 52);
8744
8766
  return internalQueryRef.observable.subscribeToMore(options);
8745
8767
  }, [internalQueryRef]);
8746
8768
  var reset = React__namespace.useCallback(function () {