@apollo/client 3.10.3 → 3.10.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 (74) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/apollo-client.cjs +106 -99
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/cache.cjs +81 -8
  6. package/cache/cache.cjs.map +1 -1
  7. package/cache/cache.cjs.native.js +81 -8
  8. package/cache/core/cache.js +8 -4
  9. package/cache/core/cache.js.map +1 -1
  10. package/core/ApolloClient.js +2 -1
  11. package/core/ApolloClient.js.map +1 -1
  12. package/core/ObservableQuery.js +1 -1
  13. package/core/ObservableQuery.js.map +1 -1
  14. package/core/QueryInfo.js +7 -11
  15. package/core/QueryInfo.js.map +1 -1
  16. package/core/core.cjs +5 -7
  17. package/core/core.cjs.map +1 -1
  18. package/core/core.cjs.native.js +5 -7
  19. package/dev/dev.cjs +32 -27
  20. package/dev/dev.cjs.map +1 -1
  21. package/dev/dev.cjs.native.js +32 -27
  22. package/invariantErrorCodes.js +32 -26
  23. package/package.json +1 -1
  24. package/react/hooks/hooks.cjs +3 -0
  25. package/react/hooks/hooks.cjs.map +1 -1
  26. package/react/hooks/hooks.cjs.native.js +3 -0
  27. package/react/hooks/useBackgroundQuery.d.ts +10 -13
  28. package/react/hooks/useBackgroundQuery.js.map +1 -1
  29. package/react/hooks/useLoadableQuery.d.ts +2 -2
  30. package/react/hooks/useLoadableQuery.js +2 -1
  31. package/react/hooks/useLoadableQuery.js.map +1 -1
  32. package/react/hooks/useQueryRefHandlers.d.ts +3 -3
  33. package/react/hooks/useQueryRefHandlers.js +3 -2
  34. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  35. package/react/hooks/useReadQuery.d.ts +2 -2
  36. package/react/hooks/useReadQuery.js +2 -1
  37. package/react/hooks/useReadQuery.js.map +1 -1
  38. package/react/internal/cache/QueryReference.d.ts +68 -6
  39. package/react/internal/cache/QueryReference.js +4 -0
  40. package/react/internal/cache/QueryReference.js.map +1 -1
  41. package/react/internal/index.d.ts +2 -2
  42. package/react/internal/index.js +1 -1
  43. package/react/internal/index.js.map +1 -1
  44. package/react/internal/internal.cjs +92 -0
  45. package/react/internal/internal.cjs.map +1 -1
  46. package/react/internal/internal.cjs.native.js +92 -0
  47. package/react/parser/index.js +5 -5
  48. package/react/parser/parser.cjs +5 -5
  49. package/react/parser/parser.cjs.map +1 -1
  50. package/react/parser/parser.cjs.native.js +5 -5
  51. package/react/query-preloader/createQueryPreloader.d.ts +6 -6
  52. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  53. package/react/types/types.d.ts +1 -1
  54. package/react/types/types.js.map +1 -1
  55. package/testing/core/core.cjs +4 -4
  56. package/testing/core/core.cjs.map +1 -1
  57. package/testing/core/core.cjs.native.js +4 -4
  58. package/testing/core/mocking/mockLink.js +5 -5
  59. package/testing/core/mocking/mockLink.js.map +1 -1
  60. package/testing/matchers/toBeDisposed.js +4 -13
  61. package/testing/matchers/toBeDisposed.js.map +1 -1
  62. package/utilities/globals/globals.cjs +1 -1
  63. package/utilities/globals/globals.cjs.map +1 -1
  64. package/utilities/globals/globals.cjs.native.js +1 -1
  65. package/utilities/graphql/DocumentTransform.js +1 -1
  66. package/utilities/graphql/directives.js +4 -4
  67. package/utilities/graphql/fragments.js +3 -3
  68. package/utilities/graphql/getFromAST.js +8 -8
  69. package/utilities/graphql/storeUtils.js +1 -1
  70. package/utilities/graphql/transform.js +2 -2
  71. package/utilities/utilities.cjs +19 -19
  72. package/utilities/utilities.cjs.map +1 -1
  73. package/utilities/utilities.cjs.native.js +19 -19
  74. package/version.js +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.10.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#11838](https://github.com/apollographql/apollo-client/pull/11838) [`8475346`](https://github.com/apollographql/apollo-client/commit/84753462af50d89c8693713990cccf432ff8267d) Thanks [@alex-kinokon](https://github.com/alex-kinokon)! - Don’t prompt for DevTools installation for browser extension page
8
+
9
+ - [#11839](https://github.com/apollographql/apollo-client/pull/11839) [`6481fe1`](https://github.com/apollographql/apollo-client/commit/6481fe1196cedee987781dcb45ebdc0cafb3998c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix a regression in [3.9.5](https://github.com/apollographql/apollo-client/releases/tag/v3.9.5) where a merge function that returned an incomplete result would not allow the client to refetch in order to fulfill the query.
10
+
11
+ - [#11844](https://github.com/apollographql/apollo-client/pull/11844) [`86984f2`](https://github.com/apollographql/apollo-client/commit/86984f24bd9076a6034acd59bbcb28a2ea1add93) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Honor the `@nonreactive` directive when using `cache.watchFragment` or the `useFragment` hook to avoid rerendering when using these directives.
12
+
13
+ - [#11824](https://github.com/apollographql/apollo-client/pull/11824) [`47ad806`](https://github.com/apollographql/apollo-client/commit/47ad806c7b0c55f1e05dbf276ca87a354ac389e5) Thanks [@phryneas](https://github.com/phryneas)! - Create branded `QueryRef` type without exposed properties.
14
+
15
+ This change deprecates `QueryReference` in favor of a `QueryRef` type that doesn't expose any properties.
16
+ This change also updates `preloadQuery` to return a new `PreloadedQueryRef` type, which exposes the `toPromise` function as it does today. This means that query refs produced by `useBackgroundQuery` and `useLoadableQuery` now return `QueryRef` types that do not have access to a `toPromise` function, which was never meant to be used in combination with these hooks.
17
+
18
+ While we tend to avoid any types of breaking changes in patch releases as this, this change was necessary to support an upcoming version of the React Server Component integration, which needed to omit the `toPromise` function that would otherwise have broken at runtime.
19
+ Note that this is a TypeScript-only change. At runtime, `toPromise` is still present on all queryRefs currently created by this package - but we strongly want to discourage you from accessing it in all cases except for the `PreloadedQueryRef` use case.
20
+
21
+ Migration is as simple as replacing all references to `QueryReference` with `QueryRef`, so it should be possible to do this with a search & replace in most code bases:
22
+
23
+ ```diff
24
+ -import { QueryReference } from '@apollo/client'
25
+ +import { QueryRef } from '@apollo/client'
26
+
27
+ - function Component({ queryRef }: { queryRef: QueryReference<TData> }) {
28
+ + function Component({ queryRef }: { queryRef: QueryRef<TData> }) {
29
+ // ...
30
+ }
31
+ ```
32
+
33
+ - [#11845](https://github.com/apollographql/apollo-client/pull/11845) [`4c5c820`](https://github.com/apollographql/apollo-client/commit/4c5c820b6172f6a2455bcdd974109513e0e2a39e) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `@nonreactive` directives from queries passed to `MockLink` to ensure they are properly matched.
34
+
35
+ - [#11837](https://github.com/apollographql/apollo-client/pull/11837) [`dff15b1`](https://github.com/apollographql/apollo-client/commit/dff15b1b03ebac9cae508c69bf607a29d0f6eccb) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where a polled query created in React strict mode may not stop polling after the component unmounts while using the `cache-and-network` fetch policy.
36
+
3
37
  ## 3.10.3
4
38
 
5
39
  ### 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.10.3";
34
+ var version = "3.10.4";
35
35
 
36
36
  function maybe(thunk) {
37
37
  try {
@@ -137,7 +137,7 @@ function shouldInclude(_a, variables) {
137
137
  if (ifArgument.value.kind === "Variable") {
138
138
  evaledValue =
139
139
  variables && variables[ifArgument.value.name.value];
140
- invariant(evaledValue !== void 0, 67, directive.name.value);
140
+ invariant(evaledValue !== void 0, 68, directive.name.value);
141
141
  }
142
142
  else {
143
143
  evaledValue = ifArgument.value.value;
@@ -172,12 +172,12 @@ function getInclusionDirectives(directives) {
172
172
  return;
173
173
  var directiveArguments = directive.arguments;
174
174
  var directiveName = directive.name.value;
175
- invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName);
175
+ invariant(directiveArguments && directiveArguments.length === 1, 69, directiveName);
176
176
  var ifArgument = directiveArguments[0];
177
- invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName);
177
+ invariant(ifArgument.name && ifArgument.name.value === "if", 70, directiveName);
178
178
  var ifValue = ifArgument.value;
179
179
  invariant(ifValue &&
180
- (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName);
180
+ (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 71, directiveName);
181
181
  result.push({ directive: directive, ifArgument: ifArgument });
182
182
  });
183
183
  }
@@ -204,7 +204,7 @@ function getFragmentQueryDocument(document, fragmentName) {
204
204
  document.definitions.forEach(function (definition) {
205
205
  if (definition.kind === "OperationDefinition") {
206
206
  throw newInvariantError(
207
- 71,
207
+ 72,
208
208
  definition.operation,
209
209
  definition.name ? " named '".concat(definition.name.value, "'") : ""
210
210
  );
@@ -214,7 +214,7 @@ function getFragmentQueryDocument(document, fragmentName) {
214
214
  }
215
215
  });
216
216
  if (typeof actualFragmentName === "undefined") {
217
- invariant(fragments.length === 1, 72, fragments.length);
217
+ invariant(fragments.length === 1, 73, fragments.length);
218
218
  actualFragmentName = fragments[0].name.value;
219
219
  }
220
220
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -255,7 +255,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
255
255
  return fragmentMap(fragmentName);
256
256
  }
257
257
  var fragment = fragmentMap && fragmentMap[fragmentName];
258
- invariant(fragment, 73, fragmentName);
258
+ invariant(fragment, 74, fragmentName);
259
259
  return fragment || null;
260
260
  }
261
261
  default:
@@ -506,7 +506,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
506
506
  argObj[name.value] = null;
507
507
  }
508
508
  else {
509
- throw newInvariantError(82, name.value, value.kind);
509
+ throw newInvariantError(83, name.value, value.kind);
510
510
  }
511
511
  }
512
512
  function storeKeyNameFromField(field, variables) {
@@ -640,16 +640,16 @@ function isInlineFragment(selection) {
640
640
  }
641
641
 
642
642
  function checkDocument(doc) {
643
- invariant(doc && doc.kind === "Document", 74);
643
+ invariant(doc && doc.kind === "Document", 75);
644
644
  var operations = doc.definitions
645
645
  .filter(function (d) { return d.kind !== "FragmentDefinition"; })
646
646
  .map(function (definition) {
647
647
  if (definition.kind !== "OperationDefinition") {
648
- throw newInvariantError(75, definition.kind);
648
+ throw newInvariantError(76, definition.kind);
649
649
  }
650
650
  return definition;
651
651
  });
652
- invariant(operations.length <= 1, 76, operations.length);
652
+ invariant(operations.length <= 1, 77, operations.length);
653
653
  return doc;
654
654
  }
655
655
  function getOperationDefinition(doc) {
@@ -672,14 +672,14 @@ function getFragmentDefinitions(doc) {
672
672
  }
673
673
  function getQueryDefinition(doc) {
674
674
  var queryDef = getOperationDefinition(doc);
675
- invariant(queryDef && queryDef.operation === "query", 77);
675
+ invariant(queryDef && queryDef.operation === "query", 78);
676
676
  return queryDef;
677
677
  }
678
678
  function getFragmentDefinition(doc) {
679
- invariant(doc.kind === "Document", 78);
680
- invariant(doc.definitions.length <= 1, 79);
679
+ invariant(doc.kind === "Document", 79);
680
+ invariant(doc.definitions.length <= 1, 80);
681
681
  var fragmentDef = doc.definitions[0];
682
- invariant(fragmentDef.kind === "FragmentDefinition", 80);
682
+ invariant(fragmentDef.kind === "FragmentDefinition", 81);
683
683
  return fragmentDef;
684
684
  }
685
685
  function getMainDefinition(queryDoc) {
@@ -702,7 +702,7 @@ function getMainDefinition(queryDoc) {
702
702
  if (fragmentDefinition) {
703
703
  return fragmentDefinition;
704
704
  }
705
- throw newInvariantError(81);
705
+ throw newInvariantError(82);
706
706
  }
707
707
  function getDefaultValues(definition) {
708
708
  var defaultValues = Object.create(null);
@@ -753,7 +753,7 @@ var DocumentTransform = (function () {
753
753
  makeCacheKey: function (document) {
754
754
  var cacheKeys = _this.getCacheKey(document);
755
755
  if (cacheKeys) {
756
- invariant(Array.isArray(cacheKeys), 66);
756
+ invariant(Array.isArray(cacheKeys), 67);
757
757
  return stableCacheKeys_1.lookupArray(cacheKeys);
758
758
  }
759
759
  },
@@ -883,7 +883,7 @@ function removeDirectivesFromDocument(directives, doc) {
883
883
  return getInUseByFragmentName(ancestor.name.value);
884
884
  }
885
885
  }
886
- globalThis.__DEV__ !== false && invariant.error(83);
886
+ globalThis.__DEV__ !== false && invariant.error(84);
887
887
  return null;
888
888
  };
889
889
  var operationCount = 0;
@@ -2381,6 +2381,72 @@ var HttpLink = (function (_super) {
2381
2381
  return HttpLink;
2382
2382
  }(ApolloLink));
2383
2383
 
2384
+ function equalByQuery(query, _a, _b, variables) {
2385
+ var aData = _a.data, aRest = tslib.__rest(_a, ["data"]);
2386
+ var bData = _b.data, bRest = tslib.__rest(_b, ["data"]);
2387
+ return (equal__default(aRest, bRest) &&
2388
+ equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {
2389
+ fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
2390
+ variables: variables,
2391
+ }));
2392
+ }
2393
+ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
2394
+ if (aResult === bResult) {
2395
+ return true;
2396
+ }
2397
+ var seenSelections = new Set();
2398
+ return selectionSet.selections.every(function (selection) {
2399
+ if (seenSelections.has(selection))
2400
+ return true;
2401
+ seenSelections.add(selection);
2402
+ if (!shouldInclude(selection, context.variables))
2403
+ return true;
2404
+ if (selectionHasNonreactiveDirective(selection))
2405
+ return true;
2406
+ if (isField(selection)) {
2407
+ var resultKey = resultKeyNameFromField(selection);
2408
+ var aResultChild = aResult && aResult[resultKey];
2409
+ var bResultChild = bResult && bResult[resultKey];
2410
+ var childSelectionSet = selection.selectionSet;
2411
+ if (!childSelectionSet) {
2412
+ return equal__default(aResultChild, bResultChild);
2413
+ }
2414
+ var aChildIsArray = Array.isArray(aResultChild);
2415
+ var bChildIsArray = Array.isArray(bResultChild);
2416
+ if (aChildIsArray !== bChildIsArray)
2417
+ return false;
2418
+ if (aChildIsArray && bChildIsArray) {
2419
+ var length_1 = aResultChild.length;
2420
+ if (bResultChild.length !== length_1) {
2421
+ return false;
2422
+ }
2423
+ for (var i = 0; i < length_1; ++i) {
2424
+ if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) {
2425
+ return false;
2426
+ }
2427
+ }
2428
+ return true;
2429
+ }
2430
+ return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context);
2431
+ }
2432
+ else {
2433
+ var fragment = getFragmentFromSelection(selection, context.fragmentMap);
2434
+ if (fragment) {
2435
+ if (selectionHasNonreactiveDirective(fragment))
2436
+ return true;
2437
+ return equalBySelectionSet(fragment.selectionSet,
2438
+ aResult, bResult, context);
2439
+ }
2440
+ }
2441
+ });
2442
+ }
2443
+ function selectionHasNonreactiveDirective(selection) {
2444
+ return (!!selection.directives && selection.directives.some(directiveIsNonreactive));
2445
+ }
2446
+ function directiveIsNonreactive(dir) {
2447
+ return dir.name.value === "nonreactive";
2448
+ }
2449
+
2384
2450
  var ApolloCache = (function () {
2385
2451
  function ApolloCache() {
2386
2452
  this.assumeImmutableResults = false;
@@ -2424,16 +2490,19 @@ var ApolloCache = (function () {
2424
2490
  ApolloCache.prototype.watchFragment = function (options) {
2425
2491
  var _this = this;
2426
2492
  var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a;
2493
+ var query = this.getFragmentDoc(fragment, fragmentName);
2427
2494
  var diffOptions = {
2428
2495
  returnPartialData: true,
2429
2496
  id: typeof from === "string" ? from : this.identify(from),
2430
- query: this.getFragmentDoc(fragment, fragmentName),
2497
+ query: query,
2431
2498
  optimistic: optimistic,
2432
2499
  };
2433
2500
  var latestDiff;
2434
2501
  return new zenObservableTs.Observable(function (observer) {
2435
- return _this.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, query: _this.getFragmentDoc(fragment, fragmentName), callback: function (diff) {
2436
- if (equal.equal(diff, latestDiff)) {
2502
+ return _this.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
2503
+ if (
2504
+ latestDiff &&
2505
+ equalByQuery(query, { data: latestDiff === null || latestDiff === void 0 ? void 0 : latestDiff.result }, { data: diff.result })) {
2437
2506
  return;
2438
2507
  }
2439
2508
  var result = {
@@ -4805,72 +4874,6 @@ function isNetworkRequestSettled(networkStatus) {
4805
4874
  return networkStatus === 7 || networkStatus === 8;
4806
4875
  }
4807
4876
 
4808
- function equalByQuery(query, _a, _b, variables) {
4809
- var aData = _a.data, aRest = tslib.__rest(_a, ["data"]);
4810
- var bData = _b.data, bRest = tslib.__rest(_b, ["data"]);
4811
- return (equal__default(aRest, bRest) &&
4812
- equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {
4813
- fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
4814
- variables: variables,
4815
- }));
4816
- }
4817
- function equalBySelectionSet(selectionSet, aResult, bResult, context) {
4818
- if (aResult === bResult) {
4819
- return true;
4820
- }
4821
- var seenSelections = new Set();
4822
- return selectionSet.selections.every(function (selection) {
4823
- if (seenSelections.has(selection))
4824
- return true;
4825
- seenSelections.add(selection);
4826
- if (!shouldInclude(selection, context.variables))
4827
- return true;
4828
- if (selectionHasNonreactiveDirective(selection))
4829
- return true;
4830
- if (isField(selection)) {
4831
- var resultKey = resultKeyNameFromField(selection);
4832
- var aResultChild = aResult && aResult[resultKey];
4833
- var bResultChild = bResult && bResult[resultKey];
4834
- var childSelectionSet = selection.selectionSet;
4835
- if (!childSelectionSet) {
4836
- return equal__default(aResultChild, bResultChild);
4837
- }
4838
- var aChildIsArray = Array.isArray(aResultChild);
4839
- var bChildIsArray = Array.isArray(bResultChild);
4840
- if (aChildIsArray !== bChildIsArray)
4841
- return false;
4842
- if (aChildIsArray && bChildIsArray) {
4843
- var length_1 = aResultChild.length;
4844
- if (bResultChild.length !== length_1) {
4845
- return false;
4846
- }
4847
- for (var i = 0; i < length_1; ++i) {
4848
- if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) {
4849
- return false;
4850
- }
4851
- }
4852
- return true;
4853
- }
4854
- return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context);
4855
- }
4856
- else {
4857
- var fragment = getFragmentFromSelection(selection, context.fragmentMap);
4858
- if (fragment) {
4859
- if (selectionHasNonreactiveDirective(fragment))
4860
- return true;
4861
- return equalBySelectionSet(fragment.selectionSet,
4862
- aResult, bResult, context);
4863
- }
4864
- }
4865
- });
4866
- }
4867
- function selectionHasNonreactiveDirective(selection) {
4868
- return (!!selection.directives && selection.directives.some(directiveIsNonreactive));
4869
- }
4870
- function directiveIsNonreactive(dir) {
4871
- return dir.name.value === "nonreactive";
4872
- }
4873
-
4874
4877
  var assign = Object.assign, hasOwnProperty$2 = Object.hasOwnProperty;
4875
4878
  var ObservableQuery = (function (_super) {
4876
4879
  tslib.__extends(ObservableQuery, _super);
@@ -5242,7 +5245,7 @@ var ObservableQuery = (function (_super) {
5242
5245
  return;
5243
5246
  }
5244
5247
  var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval;
5245
- if (!pollInterval) {
5248
+ if (!pollInterval || !this.hasObservers()) {
5246
5249
  if (pollingInfo) {
5247
5250
  clearTimeout(pollingInfo.timeout);
5248
5251
  delete this.pollingInfo;
@@ -5857,10 +5860,7 @@ var QueryInfo = (function () {
5857
5860
  var _this = this;
5858
5861
  var _a;
5859
5862
  var oldDiff = this.lastDiff && this.lastDiff.diff;
5860
- if (diff &&
5861
- !diff.complete &&
5862
- !((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.options.returnPartialData) &&
5863
- !(oldDiff && oldDiff.complete)) {
5863
+ if (diff && !diff.complete && ((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.getLastError())) {
5864
5864
  return;
5865
5865
  }
5866
5866
  this.updateLastDiff(diff);
@@ -7029,7 +7029,8 @@ var ApolloClient = (function () {
7029
7029
  if (typeof window !== "undefined" &&
7030
7030
  window.document &&
7031
7031
  window.top === window.self &&
7032
- !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
7032
+ !window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ &&
7033
+ /^(https?|file):$/.test(window.location.protocol)) {
7033
7034
  var nav = window.navigator;
7034
7035
  var ua = nav && nav.userAgent;
7035
7036
  var url = void 0;
@@ -7337,7 +7338,7 @@ function parser(document) {
7337
7338
  if (cached)
7338
7339
  return cached;
7339
7340
  var variables, type, name;
7340
- invariant(!!document && !!document.kind, 59, document);
7341
+ invariant(!!document && !!document.kind, 60, document);
7341
7342
  var fragments = [];
7342
7343
  var queries = [];
7343
7344
  var mutations = [];
@@ -7365,10 +7366,10 @@ function parser(document) {
7365
7366
  invariant(!fragments.length ||
7366
7367
  queries.length ||
7367
7368
  mutations.length ||
7368
- subscriptions.length, 60);
7369
+ subscriptions.length, 61);
7369
7370
  invariant(
7370
7371
  queries.length + mutations.length + subscriptions.length <= 1,
7371
- 61,
7372
+ 62,
7372
7373
  document,
7373
7374
  queries.length,
7374
7375
  subscriptions.length,
@@ -7380,7 +7381,7 @@ function parser(document) {
7380
7381
  var definitions = queries.length ? queries
7381
7382
  : mutations.length ? mutations
7382
7383
  : subscriptions;
7383
- invariant(definitions.length === 1, 62, document, definitions.length);
7384
+ invariant(definitions.length === 1, 63, document, definitions.length);
7384
7385
  var definition = definitions[0];
7385
7386
  variables = definition.variableDefinitions || [];
7386
7387
  if (definition.name && definition.name.kind === "Name") {
@@ -7405,7 +7406,7 @@ function verifyDocumentType(document, type) {
7405
7406
  var usedOperationName = operationName(operation.type);
7406
7407
  invariant(
7407
7408
  operation.type === type,
7408
- 63,
7409
+ 64,
7409
7410
  requiredOperationName,
7410
7411
  requiredOperationName,
7411
7412
  usedOperationName
@@ -8133,6 +8134,9 @@ function wrapQueryRef(internalQueryRef) {
8133
8134
  _a);
8134
8135
  return ref;
8135
8136
  }
8137
+ function assertWrappedQueryRef(queryRef) {
8138
+ invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 59);
8139
+ }
8136
8140
  function getWrappedPromise(queryRef) {
8137
8141
  var internalQueryRef = unwrapQueryRef(queryRef);
8138
8142
  return internalQueryRef.promise.status === "fulfilled" ?
@@ -8594,6 +8598,7 @@ function useLoadableQuery(query, options) {
8594
8598
  var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
8595
8599
  var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
8596
8600
  var _b = React__namespace.useState(null), queryRef = _b[0], setQueryRef = _b[1];
8601
+ assertWrappedQueryRef(queryRef);
8597
8602
  var internalQueryRef = queryRef && unwrapQueryRef(queryRef);
8598
8603
  if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) {
8599
8604
  var promise = internalQueryRef.applyOptions(watchQueryOptions);
@@ -8645,6 +8650,7 @@ function useQueryRefHandlers(queryRef) {
8645
8650
  : useApolloClient())(queryRef);
8646
8651
  }
8647
8652
  function _useQueryRefHandlers(queryRef) {
8653
+ assertWrappedQueryRef(queryRef);
8648
8654
  var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1];
8649
8655
  var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];
8650
8656
  var internalQueryRef = unwrapQueryRef(queryRef);
@@ -8675,6 +8681,7 @@ function useReadQuery(queryRef) {
8675
8681
  : useApolloClient())(queryRef);
8676
8682
  }
8677
8683
  function _useReadQuery(queryRef) {
8684
+ assertWrappedQueryRef(queryRef);
8678
8685
  var internalQueryRef = React__namespace.useMemo(function () { return unwrapQueryRef(queryRef); }, [queryRef]);
8679
8686
  var getPromise = React__namespace.useCallback(function () { return getWrappedPromise(queryRef); }, [queryRef]);
8680
8687
  if (internalQueryRef.disposed) {