|
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
|
|