@apollo/client 4.0.10 → 4.0.11

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 (68) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/__cjs/cache/core/cache.cjs +1 -1
  3. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  4. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  5. package/__cjs/cache/inmemory/policies.cjs +4 -4
  6. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  7. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  8. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  9. package/__cjs/core/ApolloClient.cjs.map +1 -1
  10. package/__cjs/core/ApolloClient.d.cts +16 -1
  11. package/__cjs/core/ObservableQuery.cjs +18 -7
  12. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  13. package/__cjs/core/ObservableQuery.d.cts +1 -0
  14. package/__cjs/core/QueryManager.cjs +13 -13
  15. package/__cjs/core/QueryManager.cjs.map +1 -1
  16. package/__cjs/invariantErrorCodes.cjs +39 -33
  17. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  18. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  19. package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
  20. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  21. package/__cjs/react/hooks/useQuery.cjs +7 -4
  22. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  23. package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -0
  24. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  25. package/__cjs/utilities/internal/constants.cjs +13 -0
  26. package/__cjs/utilities/internal/constants.cjs.map +1 -0
  27. package/__cjs/utilities/internal/constants.d.cts +10 -0
  28. package/__cjs/utilities/internal/index.cjs +4 -2
  29. package/__cjs/utilities/internal/index.cjs.map +1 -1
  30. package/__cjs/utilities/internal/index.d.cts +1 -0
  31. package/__cjs/version.cjs +1 -1
  32. package/cache/core/cache.js +1 -1
  33. package/cache/inmemory/entityStore.js +3 -3
  34. package/cache/inmemory/key-extractor.js +1 -1
  35. package/cache/inmemory/policies.js +4 -4
  36. package/cache/inmemory/policies.js.map +1 -1
  37. package/cache/inmemory/readFromStore.js +2 -2
  38. package/cache/inmemory/writeToStore.js +4 -4
  39. package/core/ApolloClient.d.ts +16 -1
  40. package/core/ApolloClient.js.map +1 -1
  41. package/core/ObservableQuery.d.ts +1 -0
  42. package/core/ObservableQuery.js +19 -8
  43. package/core/ObservableQuery.js.map +1 -1
  44. package/core/QueryManager.js +13 -13
  45. package/core/QueryManager.js.map +1 -1
  46. package/invariantErrorCodes.js +39 -33
  47. package/link/http/parseAndCheckHttpResponse.js +1 -1
  48. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  49. package/package.json +1 -1
  50. package/react/hooks/useLazyQuery.js +2 -1
  51. package/react/hooks/useLazyQuery.js.map +1 -1
  52. package/react/hooks/useQuery.js +8 -5
  53. package/react/hooks/useQuery.js.map +1 -1
  54. package/react/hooks/useSuspenseQuery.js +2 -0
  55. package/react/hooks/useSuspenseQuery.js.map +1 -1
  56. package/react/hooks-compiled/useLazyQuery.js +2 -1
  57. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  58. package/react/hooks-compiled/useQuery.js +9 -5
  59. package/react/hooks-compiled/useQuery.js.map +1 -1
  60. package/react/hooks-compiled/useSuspenseQuery.js +3 -1
  61. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  62. package/utilities/internal/constants.d.ts +10 -0
  63. package/utilities/internal/constants.js +10 -0
  64. package/utilities/internal/constants.js.map +1 -0
  65. package/utilities/internal/index.d.ts +1 -0
  66. package/utilities/internal/index.js +1 -0
  67. package/utilities/internal/index.js.map +1 -1
  68. package/version.js +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 4.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [#13050](https://github.com/apollographql/apollo-client/pull/13050) [`8020829`](https://github.com/apollographql/apollo-client/commit/8020829d8a3bdb3219a37e8d1f7b89179f721037) Thanks [@phryneas](https://github.com/phryneas)! - Replace usage of `findLast` with more backwards-compatible methods.
8
+
9
+ - [#13049](https://github.com/apollographql/apollo-client/pull/13049) [`05638de`](https://github.com/apollographql/apollo-client/commit/05638deaf598c5bf5d03b82d7deaf57468546229) Thanks [@phryneas](https://github.com/phryneas)! - Fixes an issue where queries starting with `skipToken` or lazy queries from `useLazyQuery` were included in `client.refetchQueries()` before they had been executed for the first time. While generally queries with a `standby` `fetchPolicy` should be included in refetch, these queries never had `variables` passed in, so they should be excluded until they have run once and received their actual variables.
10
+
11
+ These queries are now properly excluded from refetch operations until after their initial execution.
12
+
13
+ This change adds a new hidden option to `client.watchQuery`, `[variablesUnknownSymbol]`, which may be set `true` for queries starting with a `fetchPolicy` of `standby`. It will only be applied when creating the `ObservableQuery` instance and cannot be changed later. This flag indicates that the query's variables are not yet known, and thus it should be excluded from refetch operations until they are.
14
+ **This option is not meant for everyday use and is intended for framework integrations only.**
15
+
3
16
  ## 4.0.10
4
17
 
5
18
  ### Patch Changes
@@ -95,7 +95,7 @@ class ApolloCache {
95
95
  if (environment_1.__DEV__) {
96
96
  const actualFragmentName = fragmentName || (0, internal_1.getFragmentDefinition)(fragment).name.value;
97
97
  if (!id) {
98
- __DEV__ && invariant_1.invariant.warn(109, actualFragmentName);
98
+ __DEV__ && invariant_1.invariant.warn(110, actualFragmentName);
99
99
  }
100
100
  }
101
101
  const diffOptions = {
@@ -82,7 +82,7 @@ class EntityStore {
82
82
  // then there are no fields to be merged, so we're done.
83
83
  if (!incoming)
84
84
  return;
85
- (0, invariant_1.invariant)(typeof dataId === "string", 95);
85
+ (0, invariant_1.invariant)(typeof dataId === "string", 96);
86
86
  const merged = new internal_1.DeepMerger(storeObjectReconciler).merge(existing, incoming);
87
87
  // Even if merged === existing, existing may have come from a lower
88
88
  // layer, so we always need to set this.data[dataId] on this level.
@@ -182,7 +182,7 @@ class EntityStore {
182
182
  if (environment_1.__DEV__) {
183
183
  const checkReference = (ref) => {
184
184
  if (this.lookup(ref.__ref) === undefined) {
185
- __DEV__ && invariant_1.invariant.warn(96, ref);
185
+ __DEV__ && invariant_1.invariant.warn(97, ref);
186
186
  return true;
187
187
  }
188
188
  };
@@ -211,7 +211,7 @@ class EntityStore {
211
211
  }
212
212
  }
213
213
  if (seenReference && someNonReference !== undefined) {
214
- __DEV__ && invariant_1.invariant.warn(97, someNonReference);
214
+ __DEV__ && invariant_1.invariant.warn(98, someNonReference);
215
215
  break;
216
216
  }
217
217
  }
@@ -41,7 +41,7 @@ function keyFieldsFnFromSpecifier(specifier) {
41
41
  // context.readField for this extraction.
42
42
  extracted = extractKeyPath(object, schemaKeyPath, extractKey);
43
43
  }
44
- (0, invariant_1.invariant)(extracted !== void 0, 98, schemaKeyPath.join("."), object);
44
+ (0, invariant_1.invariant)(extracted !== void 0, 99, schemaKeyPath.join("."), object);
45
45
  return extracted;
46
46
  }));
47
47
  return `${context.typename}:${JSON.stringify(keyObject)}`;
@@ -212,7 +212,7 @@ class Policies {
212
212
  const rootId = "ROOT_" + which.toUpperCase();
213
213
  const old = this.rootTypenamesById[rootId];
214
214
  if (typename !== old) {
215
- (0, invariant_1.invariant)(!old || old === which, 99, which);
215
+ (0, invariant_1.invariant)(!old || old === which, 100, which);
216
216
  // First, delete any old __typename associated with this rootId from
217
217
  // rootIdsByTypename.
218
218
  if (old)
@@ -355,7 +355,7 @@ class Policies {
355
355
  if (supertypeSet.has(supertype)) {
356
356
  if (!typenameSupertypeSet.has(supertype)) {
357
357
  if (checkingFuzzySubtypes) {
358
- __DEV__ && invariant_1.invariant.warn(100, typename, supertype);
358
+ __DEV__ && invariant_1.invariant.warn(101, typename, supertype);
359
359
  }
360
360
  // Record positive results for faster future lookup.
361
361
  // Unfortunately, we cannot safely cache negative results,
@@ -566,7 +566,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
566
566
  }
567
567
  }
568
568
  if (environment_1.__DEV__ && options.from === void 0) {
569
- __DEV__ && invariant_1.invariant.warn(101, (0, internal_1.stringifyForDisplay)(Array.from(readFieldArgs)));
569
+ __DEV__ && invariant_1.invariant.warn(102, (0, internal_1.stringifyForDisplay)(Array.from(readFieldArgs)));
570
570
  }
571
571
  if (void 0 === options.variables) {
572
572
  options.variables = variables;
@@ -576,7 +576,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
576
576
  function makeMergeObjectsFunction(store) {
577
577
  return function mergeObjects(existing, incoming) {
578
578
  if ((0, internal_1.isArray)(existing) || (0, internal_1.isArray)(incoming)) {
579
- throw (0, invariant_1.newInvariantError)(102);
579
+ throw (0, invariant_1.newInvariantError)(103);
580
580
  }
581
581
  // These dynamic checks are necessary because the parameters of a
582
582
  // custom merge function can easily have the any type, so the type