apollographql/apollo-client (@apollo/client)
### [`v3.11.0`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#3110)
[Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.10.8...v3.11.0)
##### Potentially Breaking Fixes
- [#11789](https://togithub.com/apollographql/apollo-client/pull/11789) [`5793301`](https://togithub.com/apollographql/apollo-client/commit/579330147d6bd6f7167a35413a33746103e375cb) Thanks [@phryneas](https://togithub.com/phryneas)! - Changes usages of the `GraphQLError` type to `GraphQLFormattedError`.
This was a type bug - these errors were never `GraphQLError` instances
to begin with, and the `GraphQLError` class has additional properties that can
never be correctly rehydrated from a GraphQL result.
The correct type to use here is `GraphQLFormattedError`.
Similarly, please ensure to use the type `FormattedExecutionResult`
instead of `ExecutionResult` - the non-"Formatted" versions of these types
are for use on the server only, but don't get transported over the network.
- [#11626](https://togithub.com/apollographql/apollo-client/pull/11626) [`228429a`](https://togithub.com/apollographql/apollo-client/commit/228429a1d36eae691473b24fb641ec3cd84c8a3d) Thanks [@phryneas](https://togithub.com/phryneas)! - Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` specified.
Previously this would only be called when the current `fetchPolicy` was equal to the `fetchPolicy` option or the option was not specified. If you use `nextFetchPolicy` as a function, expect to see this function called more often.
Due to this bug, this also meant that the `fetchPolicy` might be reset to the initial `fetchPolicy`, even when you specified a `nextFetchPolicy` function. If you previously relied on this behavior, you will need to update your `nextFetchPolicy` callback function to implement this resetting behavior.
As an example, if your code looked like the following:
```js
useQuery(QUERY, {
nextFetchPolicy(currentFetchPolicy, info) {
// your logic here
}
);
```
Update your function to the following to reimplement the resetting behavior:
```js
useQuery(QUERY, {
nextFetchPolicy(currentFetchPolicy, info) {
if (info.reason === 'variables-changed') {
return info.initialFetchPolicy;
}
// your logic here
}
);
```
##### Minor Changes
- [#11923](https://togithub.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://togithub.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add support for `subscribeToMore` function to `useQueryRefHandlers`.
- [#11854](https://togithub.com/apollographql/apollo-client/pull/11854) [`3812800`](https://togithub.com/apollographql/apollo-client/commit/3812800c6e4e5e3e64f473543babdba35ce100c2) Thanks [@jcostello-atlassian](https://togithub.com/jcostello-atlassian)! - Support extensions in useSubscription
- [#11923](https://togithub.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://togithub.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add support for `subscribeToMore` function to `useLoadableQuery`.
- [#11863](https://togithub.com/apollographql/apollo-client/pull/11863) [`98e44f7`](https://togithub.com/apollographql/apollo-client/commit/98e44f74cb7c7e93a81bdc7492c9218bf4a2dcd4) Thanks [@phryneas](https://togithub.com/phryneas)! - Reimplement `useSubscription` to fix rules of React violations.
- [#11869](https://togithub.com/apollographql/apollo-client/pull/11869) [`a69327c`](https://togithub.com/apollographql/apollo-client/commit/a69327cce1b36e8855258e9b19427511e0af8748) Thanks [@phryneas](https://togithub.com/phryneas)! - Rewrite big parts of `useQuery` and `useLazyQuery` to be more compliant with the Rules of React and React Compiler
- [#11936](https://togithub.com/apollographql/apollo-client/pull/11936) [`1b23337`](https://togithub.com/apollographql/apollo-client/commit/1b23337e5a9eec4ce3ed69531ca4f4afe8e897a6) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add the ability to specify a name for the client instance for use with Apollo Client Devtools. This is useful when instantiating multiple clients to identify the client instance more easily. This deprecates the `connectToDevtools` option in favor of a new `devtools` configuration.
```ts
new ApolloClient({
devtools: {
enabled: true,
name: "Test Client",
},
});
```
This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option.
- [#11923](https://togithub.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://togithub.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add support for `subscribeToMore` function to `useBackgroundQuery`.
- [#11930](https://togithub.com/apollographql/apollo-client/pull/11930) [`a768575`](https://togithub.com/apollographql/apollo-client/commit/a768575ac1454587208aad63abc811b6a966fe72) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Deprecates experimental schema testing utilities introduced in 3.10 in favor of recommending [`@apollo/graphql-testing-library`](https://togithub.com/apollographql/graphql-testing-library).
##### Patch Changes
- [#11951](https://togithub.com/apollographql/apollo-client/pull/11951) [`0de03af`](https://togithub.com/apollographql/apollo-client/commit/0de03af912a76c4e0111f21b4f90a073317b63b6) Thanks [@phryneas](https://togithub.com/phryneas)! - add React 19 RC to `peerDependencies`
- [#11927](https://togithub.com/apollographql/apollo-client/pull/11927) [`2941824`](https://togithub.com/apollographql/apollo-client/commit/2941824dd66cdd20eee5f2293373ad7a9cf991a4) Thanks [@phryneas](https://togithub.com/phryneas)! - Add `restart` function to `useSubscription`.
- [#11949](https://togithub.com/apollographql/apollo-client/pull/11949) [`4528918`](https://togithub.com/apollographql/apollo-client/commit/45289186bcaaa33dfe904913eb6df31e2541c219) Thanks [@alessbell](https://togithub.com/alessbell)! - Remove deprecated `watchFragment` option, `canonizeResults`
- [#11937](https://togithub.com/apollographql/apollo-client/pull/11937) [`78332be`](https://togithub.com/apollographql/apollo-client/commit/78332be32a9af0da33eb3e4100e7a76c3eac2496) Thanks [@phryneas](https://togithub.com/phryneas)! - `createSchemaFetch`: simulate serialized errors instead of an `ApolloError` instance
- [#11902](https://togithub.com/apollographql/apollo-client/pull/11902) [`96422ce`](https://togithub.com/apollographql/apollo-client/commit/96422ce95b923b560321a88acd2eec35cf2a1c18) Thanks [@phryneas](https://togithub.com/phryneas)! - Add `cause` field to `ApolloError`.
- [#11806](https://togithub.com/apollographql/apollo-client/pull/11806) [`8df6013`](https://togithub.com/apollographql/apollo-client/commit/8df6013b6b45452ec058fab3e068b5b6d6c493f7) Thanks [@phryneas](https://togithub.com/phryneas)! - MockLink: add query default variables if not specified in mock request
- [#11926](https://togithub.com/apollographql/apollo-client/pull/11926) [`3dd6432`](https://togithub.com/apollographql/apollo-client/commit/3dd64324dc5156450cead27f8141ea93315ffe65) Thanks [@phryneas](https://togithub.com/phryneas)! - `watchFragment`: forward additional options to `diffOptions`
- [#11946](https://togithub.com/apollographql/apollo-client/pull/11946) [`7d833b8`](https://togithub.com/apollographql/apollo-client/commit/7d833b80119a991e6d2eb58f2c71074d697b8e63) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Fix issue where mutations were not accessible by Apollo Client Devtools in 3.11.0-rc.0.
- [#11944](https://togithub.com/apollographql/apollo-client/pull/11944) [`8f3d7eb`](https://togithub.com/apollographql/apollo-client/commit/8f3d7eb3bc2e0c2d79c5b1856655abe829390742) Thanks [@sneyderdev](https://togithub.com/sneyderdev)! - Allow `IgnoreModifier` to be returned from a `optimisticResponse` function when inferring from a `TypedDocumentNode` when used with a generic argument.
- [#11954](https://togithub.com/apollographql/apollo-client/pull/11954) [`4a6e86a`](https://togithub.com/apollographql/apollo-client/commit/4a6e86aeaf6685abf0dd23110784848c8b085735) Thanks [@phryneas](https://togithub.com/phryneas)! - Document (and deprecate) the previously undocumented `errors` property on the `useQuery` `QueryResult` type.
- [#11719](https://togithub.com/apollographql/apollo-client/pull/11719) [`09a6677`](https://togithub.com/apollographql/apollo-client/commit/09a6677ec1a0cffedeecb2cbac5cd3a3c8aa0fa1) Thanks [@phryneas](https://togithub.com/phryneas)! - Allow wrapping `createQueryPreloader`
- [#11921](https://togithub.com/apollographql/apollo-client/pull/11921) [`70406bf`](https://togithub.com/apollographql/apollo-client/commit/70406bfd2b9a645d781638569853d9b435e047df) Thanks [@phryneas](https://togithub.com/phryneas)! - add `ignoreResults` option to `useSubscription`
### [`v3.10.8`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#3108)
[Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.10.7...v3.10.8)
##### Patch Changes
- [#11911](https://togithub.com/apollographql/apollo-client/pull/11911) [`1f0460a`](https://togithub.com/apollographql/apollo-client/commit/1f0460a60fc613e8d6f218a74ded69e81e960791) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Allow `undefined` to be returned from a `cache.modify` modifier function when a generic type argument is used.
Configuration
š Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
š¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
ā» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
š Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
3.10.7
->3.11.0
Release Notes
apollographql/apollo-client (@apollo/client)
### [`v3.11.0`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#3110) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.10.8...v3.11.0) ##### Potentially Breaking Fixes - [#11789](https://togithub.com/apollographql/apollo-client/pull/11789) [`5793301`](https://togithub.com/apollographql/apollo-client/commit/579330147d6bd6f7167a35413a33746103e375cb) Thanks [@phryneas](https://togithub.com/phryneas)! - Changes usages of the `GraphQLError` type to `GraphQLFormattedError`. This was a type bug - these errors were never `GraphQLError` instances to begin with, and the `GraphQLError` class has additional properties that can never be correctly rehydrated from a GraphQL result. The correct type to use here is `GraphQLFormattedError`. Similarly, please ensure to use the type `FormattedExecutionResult` instead of `ExecutionResult` - the non-"Formatted" versions of these types are for use on the server only, but don't get transported over the network. - [#11626](https://togithub.com/apollographql/apollo-client/pull/11626) [`228429a`](https://togithub.com/apollographql/apollo-client/commit/228429a1d36eae691473b24fb641ec3cd84c8a3d) Thanks [@phryneas](https://togithub.com/phryneas)! - Call `nextFetchPolicy` with "variables-changed" even if there is a `fetchPolicy` specified. Previously this would only be called when the current `fetchPolicy` was equal to the `fetchPolicy` option or the option was not specified. If you use `nextFetchPolicy` as a function, expect to see this function called more often. Due to this bug, this also meant that the `fetchPolicy` might be reset to the initial `fetchPolicy`, even when you specified a `nextFetchPolicy` function. If you previously relied on this behavior, you will need to update your `nextFetchPolicy` callback function to implement this resetting behavior. As an example, if your code looked like the following: ```js useQuery(QUERY, { nextFetchPolicy(currentFetchPolicy, info) { // your logic here } ); ``` Update your function to the following to reimplement the resetting behavior: ```js useQuery(QUERY, { nextFetchPolicy(currentFetchPolicy, info) { if (info.reason === 'variables-changed') { return info.initialFetchPolicy; } // your logic here } ); ``` ##### Minor Changes - [#11923](https://togithub.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://togithub.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add support for `subscribeToMore` function to `useQueryRefHandlers`. - [#11854](https://togithub.com/apollographql/apollo-client/pull/11854) [`3812800`](https://togithub.com/apollographql/apollo-client/commit/3812800c6e4e5e3e64f473543babdba35ce100c2) Thanks [@jcostello-atlassian](https://togithub.com/jcostello-atlassian)! - Support extensions in useSubscription - [#11923](https://togithub.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://togithub.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add support for `subscribeToMore` function to `useLoadableQuery`. - [#11863](https://togithub.com/apollographql/apollo-client/pull/11863) [`98e44f7`](https://togithub.com/apollographql/apollo-client/commit/98e44f74cb7c7e93a81bdc7492c9218bf4a2dcd4) Thanks [@phryneas](https://togithub.com/phryneas)! - Reimplement `useSubscription` to fix rules of React violations. - [#11869](https://togithub.com/apollographql/apollo-client/pull/11869) [`a69327c`](https://togithub.com/apollographql/apollo-client/commit/a69327cce1b36e8855258e9b19427511e0af8748) Thanks [@phryneas](https://togithub.com/phryneas)! - Rewrite big parts of `useQuery` and `useLazyQuery` to be more compliant with the Rules of React and React Compiler - [#11936](https://togithub.com/apollographql/apollo-client/pull/11936) [`1b23337`](https://togithub.com/apollographql/apollo-client/commit/1b23337e5a9eec4ce3ed69531ca4f4afe8e897a6) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add the ability to specify a name for the client instance for use with Apollo Client Devtools. This is useful when instantiating multiple clients to identify the client instance more easily. This deprecates the `connectToDevtools` option in favor of a new `devtools` configuration. ```ts new ApolloClient({ devtools: { enabled: true, name: "Test Client", }, }); ``` This option is backwards-compatible with `connectToDevtools` and will be used in the absense of a `devtools` option. - [#11923](https://togithub.com/apollographql/apollo-client/pull/11923) [`d88c7f8`](https://togithub.com/apollographql/apollo-client/commit/d88c7f8909e3cb31532e8b1fc7dd06be12f35591) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Add support for `subscribeToMore` function to `useBackgroundQuery`. - [#11930](https://togithub.com/apollographql/apollo-client/pull/11930) [`a768575`](https://togithub.com/apollographql/apollo-client/commit/a768575ac1454587208aad63abc811b6a966fe72) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Deprecates experimental schema testing utilities introduced in 3.10 in favor of recommending [`@apollo/graphql-testing-library`](https://togithub.com/apollographql/graphql-testing-library). ##### Patch Changes - [#11951](https://togithub.com/apollographql/apollo-client/pull/11951) [`0de03af`](https://togithub.com/apollographql/apollo-client/commit/0de03af912a76c4e0111f21b4f90a073317b63b6) Thanks [@phryneas](https://togithub.com/phryneas)! - add React 19 RC to `peerDependencies` - [#11927](https://togithub.com/apollographql/apollo-client/pull/11927) [`2941824`](https://togithub.com/apollographql/apollo-client/commit/2941824dd66cdd20eee5f2293373ad7a9cf991a4) Thanks [@phryneas](https://togithub.com/phryneas)! - Add `restart` function to `useSubscription`. - [#11949](https://togithub.com/apollographql/apollo-client/pull/11949) [`4528918`](https://togithub.com/apollographql/apollo-client/commit/45289186bcaaa33dfe904913eb6df31e2541c219) Thanks [@alessbell](https://togithub.com/alessbell)! - Remove deprecated `watchFragment` option, `canonizeResults` - [#11937](https://togithub.com/apollographql/apollo-client/pull/11937) [`78332be`](https://togithub.com/apollographql/apollo-client/commit/78332be32a9af0da33eb3e4100e7a76c3eac2496) Thanks [@phryneas](https://togithub.com/phryneas)! - `createSchemaFetch`: simulate serialized errors instead of an `ApolloError` instance - [#11902](https://togithub.com/apollographql/apollo-client/pull/11902) [`96422ce`](https://togithub.com/apollographql/apollo-client/commit/96422ce95b923b560321a88acd2eec35cf2a1c18) Thanks [@phryneas](https://togithub.com/phryneas)! - Add `cause` field to `ApolloError`. - [#11806](https://togithub.com/apollographql/apollo-client/pull/11806) [`8df6013`](https://togithub.com/apollographql/apollo-client/commit/8df6013b6b45452ec058fab3e068b5b6d6c493f7) Thanks [@phryneas](https://togithub.com/phryneas)! - MockLink: add query default variables if not specified in mock request - [#11926](https://togithub.com/apollographql/apollo-client/pull/11926) [`3dd6432`](https://togithub.com/apollographql/apollo-client/commit/3dd64324dc5156450cead27f8141ea93315ffe65) Thanks [@phryneas](https://togithub.com/phryneas)! - `watchFragment`: forward additional options to `diffOptions` - [#11946](https://togithub.com/apollographql/apollo-client/pull/11946) [`7d833b8`](https://togithub.com/apollographql/apollo-client/commit/7d833b80119a991e6d2eb58f2c71074d697b8e63) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Fix issue where mutations were not accessible by Apollo Client Devtools in 3.11.0-rc.0. - [#11944](https://togithub.com/apollographql/apollo-client/pull/11944) [`8f3d7eb`](https://togithub.com/apollographql/apollo-client/commit/8f3d7eb3bc2e0c2d79c5b1856655abe829390742) Thanks [@sneyderdev](https://togithub.com/sneyderdev)! - Allow `IgnoreModifier` to be returned from a `optimisticResponse` function when inferring from a `TypedDocumentNode` when used with a generic argument. - [#11954](https://togithub.com/apollographql/apollo-client/pull/11954) [`4a6e86a`](https://togithub.com/apollographql/apollo-client/commit/4a6e86aeaf6685abf0dd23110784848c8b085735) Thanks [@phryneas](https://togithub.com/phryneas)! - Document (and deprecate) the previously undocumented `errors` property on the `useQuery` `QueryResult` type. - [#11719](https://togithub.com/apollographql/apollo-client/pull/11719) [`09a6677`](https://togithub.com/apollographql/apollo-client/commit/09a6677ec1a0cffedeecb2cbac5cd3a3c8aa0fa1) Thanks [@phryneas](https://togithub.com/phryneas)! - Allow wrapping `createQueryPreloader` - [#11921](https://togithub.com/apollographql/apollo-client/pull/11921) [`70406bf`](https://togithub.com/apollographql/apollo-client/commit/70406bfd2b9a645d781638569853d9b435e047df) Thanks [@phryneas](https://togithub.com/phryneas)! - add `ignoreResults` option to `useSubscription` ### [`v3.10.8`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#3108) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.10.7...v3.10.8) ##### Patch Changes - [#11911](https://togithub.com/apollographql/apollo-client/pull/11911) [`1f0460a`](https://togithub.com/apollographql/apollo-client/commit/1f0460a60fc613e8d6f218a74ded69e81e960791) Thanks [@jerelmiller](https://togithub.com/jerelmiller)! - Allow `undefined` to be returned from a `cache.modify` modifier function when a generic type argument is used.Configuration
š Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
š¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
ā» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
š Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.