|
1 | 1 | # @apollo/client |
2 | 2 |
|
| 3 | +## 4.1.0-alpha.3 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#12971](https://github.com/apollographql/apollo-client/pull/12971) [`d11eb40`](https://github.com/apollographql/apollo-client/commit/d11eb40aa41d90ac664705bac01158d58bf55e9b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for `from: null` in `client.watchFragment` and `cache.watchFragment`. When `from` is `null`, the emitted result is: |
| 8 | + |
| 9 | + ```ts |
| 10 | + { |
| 11 | + data: null, |
| 12 | + dataState: "complete", |
| 13 | + complete: true, |
| 14 | + } |
| 15 | + ``` |
| 16 | + |
| 17 | +- [#12971](https://github.com/apollographql/apollo-client/pull/12971) [`d11eb40`](https://github.com/apollographql/apollo-client/commit/d11eb40aa41d90ac664705bac01158d58bf55e9b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add support for arrays with `useFragment`, `useSuspenseFragment`, and `client.watchFragment`. This allows the ability to use a fragment to watch multiple entities in the cache. Passing an array to `from` will return `data` as an array where each array index corresponds to the index in the `from` array. |
| 18 | + |
| 19 | + ```ts |
| 20 | + function MyComponent() { |
| 21 | + const result = useFragment({ |
| 22 | + fragment, |
| 23 | + from: [item1, item2, item3], |
| 24 | + }); |
| 25 | + |
| 26 | + // `data` is an array with 3 items |
| 27 | + console.log(result); // { data: [{...}, {...}, {...}], dataState: "complete", complete: true } |
| 28 | + } |
| 29 | + ``` |
| 30 | + |
| 31 | +- [#12971](https://github.com/apollographql/apollo-client/pull/12971) [`d11eb40`](https://github.com/apollographql/apollo-client/commit/d11eb40aa41d90ac664705bac01158d58bf55e9b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add a `getCurrentResult` function to the observable returned by `client.watchFragment` and `cache.watchFragment` that returns the current value for the watched fragment. |
| 32 | + |
| 33 | + ```ts |
| 34 | + const observable = client.watchFragment({ |
| 35 | + fragment, |
| 36 | + from: { __typename: "Item", id: 1 }, |
| 37 | + }); |
| 38 | + |
| 39 | + console.log(observable.getCurrentResult()); |
| 40 | + // { |
| 41 | + // data: {...}, |
| 42 | + // dataState: "complete", |
| 43 | + // complete: true, |
| 44 | + // } |
| 45 | + ``` |
| 46 | + |
| 47 | +### Patch Changes |
| 48 | + |
| 49 | +- [#12971](https://github.com/apollographql/apollo-client/pull/12971) [`d11eb40`](https://github.com/apollographql/apollo-client/commit/d11eb40aa41d90ac664705bac01158d58bf55e9b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Deduplicate watches created by `useFragment`, `client.watchFragment`, and `cache.watchFragment` that contain the same fragment, variables, and identifier. This should improve performance in situations where a `useFragment` or a `client.watchFragment` is used to watch the same object in multiple places of an application. |
| 50 | + |
| 51 | +- [#12982](https://github.com/apollographql/apollo-client/pull/12982) [`5c56b32`](https://github.com/apollographql/apollo-client/commit/5c56b3210a2c03e247ec9e600f1e27eb71df5e96) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ignore top-level `data` values on subsequent chunks in incremental responses. |
| 52 | + |
| 53 | +- [#12982](https://github.com/apollographql/apollo-client/pull/12982) [`5c56b32`](https://github.com/apollographql/apollo-client/commit/5c56b3210a2c03e247ec9e600f1e27eb71df5e96) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix the `Defer20220824Handler.SubsequentResult` type to match the `FormattedSubsequentIncrementalExecutionResult` type in ` [email protected]`. |
| 54 | + |
| 55 | +- [#12973](https://github.com/apollographql/apollo-client/pull/12973) [`072da24`](https://github.com/apollographql/apollo-client/commit/072da24a8daec3a646ef0cce30de32f95ea0bb23) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Update the `accept` header used with the `GraphQL17Alpha9Handler` to `multipart/mixed;incrementalSpec=v0.2` to ensure the newest incremental delivery format is requested. |
| 56 | + |
| 57 | +- [#12971](https://github.com/apollographql/apollo-client/pull/12971) [`d11eb40`](https://github.com/apollographql/apollo-client/commit/d11eb40aa41d90ac664705bac01158d58bf55e9b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `DeepPartial<Array<TData>>` now returns `Array<DeepPartial<TData>>` instead of `Array<DeepPartial<TData | undefined>>`. |
| 58 | + |
3 | 59 | ## 4.1.0-alpha.2 |
4 | 60 |
|
5 | 61 | ### Minor Changes |
|
0 commit comments