@apollo/client 3.13.0-rc.0 → 3.13.1

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 (42) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/apollo-client.cjs +4 -7
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/core/ObservableQuery.js +1 -4
  6. package/core/ObservableQuery.js.map +1 -1
  7. package/core/core.cjs +2 -5
  8. package/core/core.cjs.map +1 -1
  9. package/core/core.cjs.native.js +2 -5
  10. package/dev/dev.cjs +1 -1
  11. package/dev/dev.cjs.map +1 -1
  12. package/dev/dev.cjs.native.js +1 -1
  13. package/package.json +1 -1
  14. package/react/hooks/hooks.cjs +2 -2
  15. package/react/hooks/hooks.cjs.map +1 -1
  16. package/react/hooks/hooks.cjs.native.js +2 -2
  17. package/react/hooks/index.d.ts +1 -1
  18. package/react/hooks/index.js.map +1 -1
  19. package/react/hooks/useSuspenseFragment.d.ts +17 -5
  20. package/react/hooks/useSuspenseFragment.js +2 -2
  21. package/react/hooks/useSuspenseFragment.js.map +1 -1
  22. package/react/internal/internal.cjs +1 -1
  23. package/react/internal/internal.cjs.map +1 -1
  24. package/react/internal/internal.cjs.native.js +1 -1
  25. package/react/query-preloader/createQueryPreloader.d.ts +1 -37
  26. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  27. package/react/types/types.d.ts +37 -1
  28. package/react/types/types.js.map +1 -1
  29. package/utilities/globals/globals.cjs +1 -1
  30. package/utilities/globals/globals.cjs.map +1 -1
  31. package/utilities/globals/globals.cjs.native.js +1 -1
  32. package/version.js +1 -1
  33. package/.changeset/blue-comics-train.md +0 -7
  34. package/.changeset/bright-guests-chew.md +0 -16
  35. package/.changeset/fluffy-worms-fail.md +0 -5
  36. package/.changeset/heavy-pumas-boil.md +0 -6
  37. package/.changeset/khaki-cars-develop.md +0 -7
  38. package/.changeset/pre.json +0 -18
  39. package/.changeset/pretty-planets-cough.md +0 -24
  40. package/.changeset/quiet-apricots-reply.md +0 -6
  41. package/.changeset/sharp-windows-switch.md +0 -5
  42. package/.changeset/tough-years-destroy.md +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#12369](https://github.com/apollographql/apollo-client/pull/12369) [`bdfc5b2`](https://github.com/apollographql/apollo-client/commit/bdfc5b2e386ed5f835716a542de0cf17da37f7fc) Thanks [@phryneas](https://github.com/phryneas)! - `ObervableQuery.refetch`: don't refetch with `cache-and-network`, swich to `network-only` instead
8
+
9
+ - [#12375](https://github.com/apollographql/apollo-client/pull/12375) [`d3f8f13`](https://github.com/apollographql/apollo-client/commit/d3f8f130718ef50531ca0079192c2672a513814a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Export the `UseSuspenseFragmentOptions` type.
10
+
11
+ ## 3.13.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#12066](https://github.com/apollographql/apollo-client/pull/12066) [`c01da5d`](https://github.com/apollographql/apollo-client/commit/c01da5da639d4d9e882d380573b7876df4a1d65b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adds a new `useSuspenseFragment` hook.
16
+
17
+ `useSuspenseFragment` suspends until `data` is complete. It is a drop-in replacement for `useFragment` when you prefer to use Suspense to control the loading state of a fragment. See the [documentation](https://www.apollographql.com/docs/react/data/fragments#usesuspensefragment) for more details.
18
+
19
+ - [#12174](https://github.com/apollographql/apollo-client/pull/12174) [`ba5cc33`](https://github.com/apollographql/apollo-client/commit/ba5cc330f8734a989eef71e883861f848388ac0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure errors thrown in the `onCompleted` callback from `useMutation` don't call `onError`.
20
+
21
+ - [#12340](https://github.com/apollographql/apollo-client/pull/12340) [`716d02e`](https://github.com/apollographql/apollo-client/commit/716d02ec9c5b1448f50cb50a0306a345310a2342) Thanks [@phryneas](https://github.com/phryneas)! - Deprecate the `onCompleted` and `onError` callbacks of `useQuery` and `useLazyQuery`.
22
+ For more context, please see the [related issue](https://github.com/apollographql/apollo-client/issues/12352) on GitHub.
23
+
24
+ - [#12276](https://github.com/apollographql/apollo-client/pull/12276) [`670f112`](https://github.com/apollographql/apollo-client/commit/670f112a7d9d85cb357eb279a488ac2c6d0137a9) Thanks [@Cellule](https://github.com/Cellule)! - Provide a more type-safe option for the previous data value passed to `observableQuery.updateQuery`. Using it could result in crashes at runtime as this callback could be called with partial data even though its type reported the value as a complete result.
25
+
26
+ The `updateQuery` callback function is now called with a new type-safe `previousData` property and a new `complete` property in the 2nd argument that determines whether `previousData` is a complete or partial result.
27
+
28
+ As a result of this change, it is recommended to use the `previousData` property passed to the 2nd argument of the callback rather than using the previous data value from the first argument since that value is not type-safe. The first argument is now deprecated and will be removed in a future version of Apollo Client.
29
+
30
+ ```ts
31
+ observableQuery.updateQuery(
32
+ (unsafePreviousData, { previousData, complete }) => {
33
+ previousData;
34
+ // ^? TData | DeepPartial<TData> | undefined
35
+
36
+ if (complete) {
37
+ previousData;
38
+ // ^? TData
39
+ } else {
40
+ previousData;
41
+ // ^? DeepPartial<TData> | undefined
42
+ }
43
+ }
44
+ );
45
+ ```
46
+
47
+ - [#12174](https://github.com/apollographql/apollo-client/pull/12174) [`ba5cc33`](https://github.com/apollographql/apollo-client/commit/ba5cc330f8734a989eef71e883861f848388ac0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Reject the mutation promise if errors are thrown in the `onCompleted` callback of `useMutation`.
48
+
49
+ ### Patch Changes
50
+
51
+ - [#12276](https://github.com/apollographql/apollo-client/pull/12276) [`670f112`](https://github.com/apollographql/apollo-client/commit/670f112a7d9d85cb357eb279a488ac2c6d0137a9) Thanks [@Cellule](https://github.com/Cellule)! - Fix the return type of the `updateQuery` function to allow for `undefined`. `updateQuery` had the ability to bail out of the update by returning a falsey value, but the return type enforced a query value.
52
+
53
+ ```ts
54
+ observableQuery.updateQuery(
55
+ (unsafePreviousData, { previousData, complete }) => {
56
+ if (!complete) {
57
+ // Bail out of the update by returning early
58
+ return;
59
+ }
60
+
61
+ // ...
62
+ }
63
+ );
64
+ ```
65
+
66
+ - [#12296](https://github.com/apollographql/apollo-client/pull/12296) [`2422df2`](https://github.com/apollographql/apollo-client/commit/2422df202a7ec71365d5a8ab5b3b554fcf60e4af) Thanks [@Cellule](https://github.com/Cellule)! - Deprecate option `ignoreResults` in `useMutation`.
67
+ Once this option is removed, existing code still using it might see increase in re-renders.
68
+ If you don't want to synchronize your component state with the mutation, please use `useApolloClient` to get your ApolloClient instance and call `client.mutate` directly.
69
+
70
+ - [#12338](https://github.com/apollographql/apollo-client/pull/12338) [`67c16c9`](https://github.com/apollographql/apollo-client/commit/67c16c93897e36be980ba2139ee8bd3f24ab8558) Thanks [@phryneas](https://github.com/phryneas)! - In case of a multipart response (e.g. with `@defer`), query deduplication will
71
+ now keep going until the final chunk has been received.
72
+
73
+ - [#12276](https://github.com/apollographql/apollo-client/pull/12276) [`670f112`](https://github.com/apollographql/apollo-client/commit/670f112a7d9d85cb357eb279a488ac2c6d0137a9) Thanks [@Cellule](https://github.com/Cellule)! - Fix the type of the `variables` property passed as the 2nd argument to the `subscribeToMore` callback. This was previously reported as the `variables` type for the subscription itself, but is now properly typed as the query `variables`.
74
+
3
75
  ## 3.13.0-rc.0
4
76
 
5
77
  ### Minor Changes
package/apollo-client.cjs CHANGED
@@ -32,7 +32,7 @@ var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
32
32
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
33
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
34
34
 
35
- var version = "3.13.0-rc.0";
35
+ var version = "3.13.1";
36
36
 
37
37
  function maybe(thunk) {
38
38
  try {
@@ -5343,10 +5343,7 @@ var ObservableQuery = (function (_super) {
5343
5343
  pollInterval: 0,
5344
5344
  };
5345
5345
  var fetchPolicy = this.options.fetchPolicy;
5346
- if (fetchPolicy === "cache-and-network") {
5347
- reobserveOptions.fetchPolicy = fetchPolicy;
5348
- }
5349
- else if (fetchPolicy === "no-cache") {
5346
+ if (fetchPolicy === "no-cache") {
5350
5347
  reobserveOptions.fetchPolicy = "no-cache";
5351
5348
  }
5352
5349
  else {
@@ -9227,14 +9224,14 @@ function useSuspenseFragment(options) {
9227
9224
  }
9228
9225
  function useSuspenseFragment_(options) {
9229
9226
  var client = useApolloClient(options.client);
9230
- var from = options.from;
9227
+ var from = options.from, variables = options.variables;
9231
9228
  var cache = client.cache;
9232
9229
  var id = React.useMemo(function () {
9233
9230
  return typeof from === "string" ? from
9234
9231
  : from === null ? null
9235
9232
  : cache.identify(from);
9236
9233
  }, [cache, from]);
9237
- var fragmentRef = id === null ? null : (getSuspenseCache(client).getFragmentRef([id, options.fragment, canonicalStringify(options.variables)], client, tslib.__assign(tslib.__assign({}, options), { from: id })));
9234
+ var fragmentRef = id === null ? null : (getSuspenseCache(client).getFragmentRef([id, options.fragment, canonicalStringify(variables)], client, tslib.__assign(tslib.__assign({}, options), { variables: variables, from: id })));
9238
9235
  var _a = React__default.useState(fragmentRef === null ? NULL_PLACEHOLDER : ([fragmentRef.key, fragmentRef.promise])), current = _a[0], setPromise = _a[1];
9239
9236
  React__default.useEffect(function () {
9240
9237
  if (fragmentRef === null) {