@apollo/client 3.13.0-rc.0 → 3.13.0

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 (38) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/apollo-client.cjs +3 -3
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/core/core.cjs +1 -1
  6. package/core/core.cjs.map +1 -1
  7. package/core/core.cjs.native.js +1 -1
  8. package/dev/dev.cjs +1 -1
  9. package/dev/dev.cjs.map +1 -1
  10. package/dev/dev.cjs.native.js +1 -1
  11. package/package.json +1 -1
  12. package/react/hooks/hooks.cjs +2 -2
  13. package/react/hooks/hooks.cjs.map +1 -1
  14. package/react/hooks/hooks.cjs.native.js +2 -2
  15. package/react/hooks/useSuspenseFragment.d.ts +17 -5
  16. package/react/hooks/useSuspenseFragment.js +2 -2
  17. package/react/hooks/useSuspenseFragment.js.map +1 -1
  18. package/react/internal/internal.cjs +1 -1
  19. package/react/internal/internal.cjs.map +1 -1
  20. package/react/internal/internal.cjs.native.js +1 -1
  21. package/react/query-preloader/createQueryPreloader.d.ts +1 -37
  22. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  23. package/react/types/types.d.ts +37 -1
  24. package/react/types/types.js.map +1 -1
  25. package/utilities/globals/globals.cjs +1 -1
  26. package/utilities/globals/globals.cjs.map +1 -1
  27. package/utilities/globals/globals.cjs.native.js +1 -1
  28. package/version.js +1 -1
  29. package/.changeset/blue-comics-train.md +0 -7
  30. package/.changeset/bright-guests-chew.md +0 -16
  31. package/.changeset/fluffy-worms-fail.md +0 -5
  32. package/.changeset/heavy-pumas-boil.md +0 -6
  33. package/.changeset/khaki-cars-develop.md +0 -7
  34. package/.changeset/pre.json +0 -18
  35. package/.changeset/pretty-planets-cough.md +0 -24
  36. package/.changeset/quiet-apricots-reply.md +0 -6
  37. package/.changeset/sharp-windows-switch.md +0 -5
  38. package/.changeset/tough-years-destroy.md +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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.
8
+
9
+ `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.
10
+
11
+ - [#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`.
12
+
13
+ - [#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`.
14
+ For more context, please see the [related issue](https://github.com/apollographql/apollo-client/issues/12352) on GitHub.
15
+
16
+ - [#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.
17
+
18
+ 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.
19
+
20
+ 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.
21
+
22
+ ```ts
23
+ observableQuery.updateQuery(
24
+ (unsafePreviousData, { previousData, complete }) => {
25
+ previousData;
26
+ // ^? TData | DeepPartial<TData> | undefined
27
+
28
+ if (complete) {
29
+ previousData;
30
+ // ^? TData
31
+ } else {
32
+ previousData;
33
+ // ^? DeepPartial<TData> | undefined
34
+ }
35
+ }
36
+ );
37
+ ```
38
+
39
+ - [#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`.
40
+
41
+ ### Patch Changes
42
+
43
+ - [#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.
44
+
45
+ ```ts
46
+ observableQuery.updateQuery(
47
+ (unsafePreviousData, { previousData, complete }) => {
48
+ if (!complete) {
49
+ // Bail out of the update by returning early
50
+ return;
51
+ }
52
+
53
+ // ...
54
+ }
55
+ );
56
+ ```
57
+
58
+ - [#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`.
59
+ Once this option is removed, existing code still using it might see increase in re-renders.
60
+ 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.
61
+
62
+ - [#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
63
+ now keep going until the final chunk has been received.
64
+
65
+ - [#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`.
66
+
3
67
  ## 3.13.0-rc.0
4
68
 
5
69
  ### 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.0";
36
36
 
37
37
  function maybe(thunk) {
38
38
  try {
@@ -9227,14 +9227,14 @@ function useSuspenseFragment(options) {
9227
9227
  }
9228
9228
  function useSuspenseFragment_(options) {
9229
9229
  var client = useApolloClient(options.client);
9230
- var from = options.from;
9230
+ var from = options.from, variables = options.variables;
9231
9231
  var cache = client.cache;
9232
9232
  var id = React.useMemo(function () {
9233
9233
  return typeof from === "string" ? from
9234
9234
  : from === null ? null
9235
9235
  : cache.identify(from);
9236
9236
  }, [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 })));
9237
+ var fragmentRef = id === null ? null : (getSuspenseCache(client).getFragmentRef([id, options.fragment, canonicalStringify(variables)], client, tslib.__assign(tslib.__assign({}, options), { variables: variables, from: id })));
9238
9238
  var _a = React__default.useState(fragmentRef === null ? NULL_PLACEHOLDER : ([fragmentRef.key, fragmentRef.promise])), current = _a[0], setPromise = _a[1];
9239
9239
  React__default.useEffect(function () {
9240
9240
  if (fragmentRef === null) {