|
1 | 1 | # @apollo/client
|
2 | 2 |
|
| 3 | +## 4.0.0-rc.2 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- [#12742](https://github.com/apollographql/apollo-client/pull/12742) [`575bf3e`](https://github.com/apollographql/apollo-client/commit/575bf3ed5885efb09c1eec497af4d2690c6b87d4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The new `SetContextLink` flips the `prevContext` and `operation` arguments in the callback. The `setContext` function has remained unchanged. |
| 8 | + |
| 9 | + ```diff |
| 10 | + - new SetContextLink((operation, prevContext) => { |
| 11 | + + new SetContextLink((prevContext, operation) => { |
| 12 | + // ... |
| 13 | + }) |
| 14 | + ``` |
| 15 | + |
| 16 | +- [#12742](https://github.com/apollographql/apollo-client/pull/12742) [`575bf3e`](https://github.com/apollographql/apollo-client/commit/575bf3ed5885efb09c1eec497af4d2690c6b87d4) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The `operation` argument to the callback passed to `SetContextLink` is now of type `SetContextLink.SetContextOperation` which is an `Operation` without the `getContext` or `setContext` functions. Previously the type of `operation` was `GraphQLRequest` which had access to a `context` property. The `context` property was always `undefined` and could result in bugs when using it instead of the `prevContext` argument. |
| 17 | + |
| 18 | + This change means the `operation` argument now contains an accessible `client` property. |
| 19 | + |
| 20 | +### Minor Changes |
| 21 | + |
| 22 | +- [#12740](https://github.com/apollographql/apollo-client/pull/12740) [`1c6e03c`](https://github.com/apollographql/apollo-client/commit/1c6e03c9c74a9fad2a1c2e1c3ae61a9560038238) Thanks [@phryneas](https://github.com/phryneas)! - Overridable types for `dataState: "complete"`, `dataState: "streaming"` and |
| 23 | + `dataState: "partial"` responses. |
| 24 | + |
| 25 | + This adds the `DataValue` namespace exported from Apollo Client with the three |
| 26 | + types `DataValue.Complete`, `DataValue.Streaming` and `DataValue.Partial`. |
| 27 | + |
| 28 | + These types will be used to mark `TData` in the respective states. |
| 29 | + |
| 30 | + - `Complete` defaults to `TData` |
| 31 | + - `Streaming` defaults to `TData` |
| 32 | + - `Partial` defaults to `DeepPartial<TData>` |
| 33 | + |
| 34 | + All three can be overwritten, e.g. to be `DeepReadonly` using higher kinded types |
| 35 | + by following this pattern: |
| 36 | + |
| 37 | + ```ts |
| 38 | + import { HKT, DeepPartial } from "@apollo/client/utilities"; |
| 39 | + import { DeepReadonly } from "some-type-helper-library"; |
| 40 | + |
| 41 | + interface CompleteOverride extends HKT { |
| 42 | + return: DeepReadonly<this["arg1"]>; |
| 43 | + } |
| 44 | + |
| 45 | + interface StreamingOverride extends HKT { |
| 46 | + return: DeepReadonly<this["arg1"]>; |
| 47 | + } |
| 48 | + |
| 49 | + interface PartialOverride extends HKT { |
| 50 | + return: DeepReadonly<DeepPartial<this["arg1"]>>; |
| 51 | + } |
| 52 | + |
| 53 | + declare module "@apollo/client" { |
| 54 | + export interface TypeOverrides { |
| 55 | + Complete: CompleteOverride; |
| 56 | + Streaming: StreamingOverride; |
| 57 | + Partial: PartialOverride; |
| 58 | + } |
| 59 | + } |
| 60 | + ``` |
| 61 | + |
| 62 | +### Patch Changes |
| 63 | + |
| 64 | +- [#12748](https://github.com/apollographql/apollo-client/pull/12748) [`e1ca85e`](https://github.com/apollographql/apollo-client/commit/e1ca85eab181d8e16d945e849dfb13352902f197) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where the new `operationType` property wasn't passed into `operation`. |
| 65 | + |
| 66 | +- [#12739](https://github.com/apollographql/apollo-client/pull/12739) [`b184754`](https://github.com/apollographql/apollo-client/commit/b184754d08810df9a7838615990e90a960966037) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix type of `error` argument on the `onError` option for `subscribeToMore` to `ErrorLike`. |
| 67 | + |
3 | 68 | ## 4.0.0-rc.1
|
4 | 69 |
|
5 | 70 | ### Major Changes
|
|
0 commit comments