apollographql / apollo-client-nextjs

Apollo Client support for the Next.js App Router
https://www.npmjs.com/package/@apollo/experimental-nextjs-app-support
MIT License
351 stars 25 forks source link

chore(deps): update dependency @apollo/client to v3 - autoclosed #229

Closed svc-secops closed 1 month ago

svc-secops commented 1 month ago

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@apollo/client (source) 0.0.0-pr-11617-20240227102358 -> 3.9.5 age adoption passing confidence

[!WARNING] Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

apollographql/apollo-client (@​apollo/client) ### [`v3.9.5`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#395) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.9.4...v3.9.5) ##### Patch Changes - [#​11595](https://togithub.com/apollographql/apollo-client/pull/11595) [`8c20955`](https://togithub.com/apollographql/apollo-client/commit/8c20955874562e5b2ab35557325e047b059bc4fc) Thanks [@​phryneas](https://togithub.com/phryneas)! - Bumps the dependency `rehackt` to 0.0.5 - [#​11592](https://togithub.com/apollographql/apollo-client/pull/11592) [`1133469`](https://togithub.com/apollographql/apollo-client/commit/1133469bd91ff76b9815e815a454a79d8e23a9bc) Thanks [@​Stephen2](https://togithub.com/Stephen2)! - Strengthen `MockedResponse.newData` type - [#​11579](https://togithub.com/apollographql/apollo-client/pull/11579) [`1ba2fd9`](https://togithub.com/apollographql/apollo-client/commit/1ba2fd919f79dfdc7b9d3f7d1a7aa5918e648349) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Fix issue where partial data is reported to `useQuery` when using `notifyOnNetworkStatusChange` after it errors while another overlapping query succeeds. - [#​11579](https://togithub.com/apollographql/apollo-client/pull/11579) [`1ba2fd9`](https://togithub.com/apollographql/apollo-client/commit/1ba2fd919f79dfdc7b9d3f7d1a7aa5918e648349) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Fix an issue where a partial cache write for an errored query would result in automatically refetching that query. - [#​11562](https://togithub.com/apollographql/apollo-client/pull/11562) [`65ab695`](https://togithub.com/apollographql/apollo-client/commit/65ab695470741e8dcaef1ebd7742c3c397526354) Thanks [@​mspiess](https://togithub.com/mspiess)! - Mocks with an infinite delay no longer require result or error ### [`v3.9.4`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#394) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.9.3...v3.9.4) ##### Patch Changes - [#​11403](https://togithub.com/apollographql/apollo-client/pull/11403) [`b0c4f3a`](https://togithub.com/apollographql/apollo-client/commit/b0c4f3ad8198981a229b46dc430345a76e577e9c) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Fix issue in `useLazyQuery` that results in a double network call when calling the execute function with no arguments after having called it previously with another set of arguments. - [#​11576](https://togithub.com/apollographql/apollo-client/pull/11576) [`e855d00`](https://togithub.com/apollographql/apollo-client/commit/e855d00447e4d9ae478d98f6796d842ef6cc76d1) Thanks [@​alessbell](https://togithub.com/alessbell)! - Revert PR [#​11202](https://togithub.com/apollographql/apollo-client/pull/11202) to fix caching bug reported in [#​11560](https://togithub.com/apollographql/apollo-client/issues/11560) ### [`v3.9.3`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#393) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.9.2...v3.9.3) ##### Patch Changes - [#​11525](https://togithub.com/apollographql/apollo-client/pull/11525) [`dce923a`](https://togithub.com/apollographql/apollo-client/commit/dce923ae57eb6b6d889e2980635cb90e2c6cbca3) Thanks [@​vezaynk](https://togithub.com/vezaynk)! - Allows passing in client via options to useFragment - [#​11558](https://togithub.com/apollographql/apollo-client/pull/11558) [`8cba16f`](https://togithub.com/apollographql/apollo-client/commit/8cba16f041609443111ecf5fb58faea1b3e79569) Thanks [@​alessbell](https://togithub.com/alessbell)! - Fix [`unbound-method`](https://togithub.com/apollographql/apollo-client/issues/11554) linter error on ObservableQuery methods exposed on useQuery's QueryResult object. ### [`v3.9.2`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#392) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.9.1...v3.9.2) ##### Patch Changes - [#​11552](https://togithub.com/apollographql/apollo-client/pull/11552) [`6ac2b0c`](https://togithub.com/apollographql/apollo-client/commit/6ac2b0ce4d999c63478d85b40ad56ccda9624797) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Fix import in `useLazyRef` causing import issues in the nextjs package. ### [`v3.9.1`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#391) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.9.0...v3.9.1) ##### Patch Changes - [#​11516](https://togithub.com/apollographql/apollo-client/pull/11516) [`8390fea`](https://togithub.com/apollographql/apollo-client/commit/8390fea13175bada8361ba5f0df2e43197085aba) Thanks [@​phryneas](https://togithub.com/phryneas)! - Fix an incorrect string substitution in a warning message. - [#​11515](https://togithub.com/apollographql/apollo-client/pull/11515) [`c9bf93b`](https://togithub.com/apollographql/apollo-client/commit/c9bf93bdc2816f7fdba96961e1435f463f440bd1) Thanks [@​vladar](https://togithub.com/vladar)! - Avoid redundant refetchQueries call for mutation with no-cache policy (fixes [#​10238](https://togithub.com/apollographql/apollo-client/issues/10238)) - [#​11545](https://togithub.com/apollographql/apollo-client/pull/11545) [`84a6bea`](https://togithub.com/apollographql/apollo-client/commit/84a6beaeae69acdffea49ba6b8242752cc188172) Thanks [@​alessbell](https://togithub.com/alessbell)! - Remove error thrown by `inFlightLinkObservables` intended to be removed before 3.9 release. ### [`v3.9.0`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#390) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.10...v3.9.0) ##### Minor Changes ##### Memory optimizations - [#​11424](https://togithub.com/apollographql/apollo-client/pull/11424) [`62f3b6d`](https://togithub.com/apollographql/apollo-client/commit/62f3b6d0e89611e27d9f29812ee60e5db5963fd6) Thanks [@​phryneas](https://togithub.com/phryneas)! - Simplify RetryLink, fix potential memory leak Historically, `RetryLink` would keep a `values` array of all previous values, in case the operation would get an additional subscriber at a later point in time. In practice, this could lead to a memory leak ([#​11393](https://togithub.com/apollographql/apollo-client/pull/11393)) and did not serve any further purpose, as the resulting observable would only be subscribed to by Apollo Client itself, and only once - it would be wrapped in a `Concast` before being exposed to the user, and that `Concast` would handle subscribers on its own. - [#​11435](https://togithub.com/apollographql/apollo-client/pull/11435) [`5cce53e`](https://togithub.com/apollographql/apollo-client/commit/5cce53e83b976f85d2d2b06e28cc38f01324fea1) Thanks [@​phryneas](https://togithub.com/phryneas)! - Deprecates `canonizeResults`. Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks. - [#​11254](https://togithub.com/apollographql/apollo-client/pull/11254) [`d08970d`](https://togithub.com/apollographql/apollo-client/commit/d08970d348cf4ad6d80c6baf85b4a4cd4034a3bb) Thanks [@​benjamn](https://togithub.com/benjamn)! - Decouple `canonicalStringify` from `ObjectCanon` for better time and memory performance. - [#​11356](https://togithub.com/apollographql/apollo-client/pull/11356) [`cc4ac7e`](https://togithub.com/apollographql/apollo-client/commit/cc4ac7e1917f046bcd177882727864eed40b910e) Thanks [@​phryneas](https://togithub.com/phryneas)! - Fix a potential memory leak in `FragmentRegistry.transform` and `FragmentRegistry.findFragmentSpreads` that would hold on to passed-in `DocumentNodes` for too long. - [#​11370](https://togithub.com/apollographql/apollo-client/pull/11370) [`25e2cb4`](https://togithub.com/apollographql/apollo-client/commit/25e2cb431c76ec5aa88202eaacbd98fad42edc7f) Thanks [@​phryneas](https://togithub.com/phryneas)! - `parse` function: improve memory management - use LRU `WeakCache` instead of `Map` to keep a limited number of parsed results - cache is initiated lazily, only when needed - expose `parse.resetCache()` method - [#​11389](https://togithub.com/apollographql/apollo-client/pull/11389) [`139acd1`](https://togithub.com/apollographql/apollo-client/commit/139acd1153afa1445b69dcb4e139668ab8c5889a) Thanks [@​phryneas](https://togithub.com/phryneas)! - `documentTransform`: use `optimism` and `WeakCache` instead of directly storing data on the `Trie` - [#​11358](https://togithub.com/apollographql/apollo-client/pull/11358) [`7d939f8`](https://togithub.com/apollographql/apollo-client/commit/7d939f80fbc2c419c58a6c55b6a35ee7474d0379) Thanks [@​phryneas](https://togithub.com/phryneas)! - Fixes a potential memory leak in `Concast` that might have been triggered when `Concast` was used outside of Apollo Client. - [#​11344](https://togithub.com/apollographql/apollo-client/pull/11344) [`bd26676`](https://togithub.com/apollographql/apollo-client/commit/bd2667619700139af32a45364794d11f845ab6cf) Thanks [@​phryneas](https://togithub.com/phryneas)! - Add a `resetCache` method to `DocumentTransform` and hook `InMemoryCache.addTypenameTransform` up to `InMemoryCache.gc` - [#​11367](https://togithub.com/apollographql/apollo-client/pull/11367) [`30d17bf`](https://togithub.com/apollographql/apollo-client/commit/30d17bfebe44dbfa7b78c8982cfeb49afd37129c) Thanks [@​phryneas](https://togithub.com/phryneas)! - `print`: use `WeakCache` instead of `WeakMap` - [#​11387](https://togithub.com/apollographql/apollo-client/pull/11387) [`4dce867`](https://togithub.com/apollographql/apollo-client/commit/4dce8673b1757d8a3a4edd2996d780e86fad14e3) Thanks [@​phryneas](https://togithub.com/phryneas)! - `QueryManager.transformCache`: use `WeakCache` instead of `WeakMap` - [#​11369](https://togithub.com/apollographql/apollo-client/pull/11369) [`2a47164`](https://togithub.com/apollographql/apollo-client/commit/2a471646616e3af1b5c039e961f8d5717fad8f32) Thanks [@​phryneas](https://togithub.com/phryneas)! - Persisted Query Link: improve memory management - use LRU `WeakCache` instead of `WeakMap` to keep a limited number of hash results - hash cache is initiated lazily, only when needed - expose `persistedLink.resetHashCache()` method - reset hash cache if the upstream server reports it doesn't accept persisted queries - [#​10804](https://togithub.com/apollographql/apollo-client/pull/10804) [`221dd99`](https://togithub.com/apollographql/apollo-client/commit/221dd99ffd1990f8bd0392543af35e9b08d0fed8) Thanks [@​phryneas](https://togithub.com/phryneas)! - use WeakMap in React Native with Hermes - [#​11355](https://togithub.com/apollographql/apollo-client/pull/11355) [`7d8e184`](https://togithub.com/apollographql/apollo-client/commit/7d8e18493cd13134726c6643cbf0fadb08be2d37) Thanks [@​phryneas](https://togithub.com/phryneas)! - InMemoryCache.gc now also triggers FragmentRegistry.resetCaches (if there is a FragmentRegistry) - [#​11409](https://togithub.com/apollographql/apollo-client/pull/11409) [`2e7203b`](https://togithub.com/apollographql/apollo-client/commit/2e7203b3a9618952ddb522627ded7cceabd7f250) Thanks [@​phryneas](https://togithub.com/phryneas)! - Adds an experimental `ApolloClient.getMemoryInternals` helper - [#​11343](https://togithub.com/apollographql/apollo-client/pull/11343) [`776631d`](https://togithub.com/apollographql/apollo-client/commit/776631de4500d56252f6f5fdaf29a81c41dfbdc7) Thanks [@​phryneas](https://togithub.com/phryneas)! - Add `reset` method to `print`, hook up to `InMemoryCache.gc` ##### Suspense-enabled data fetching on user interaction with `useLoadableQuery` - [#​11300](https://togithub.com/apollographql/apollo-client/pull/11300) [`a815873`](https://togithub.com/apollographql/apollo-client/commit/a8158733cfa3e65180ec23518d657ea41894bb2b) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Introduces a new `useLoadableQuery` hook. This hook works similarly to `useBackgroundQuery` in that it returns a `queryRef` that can be used to suspend a component via the `useReadQuery` hook. It provides a more ergonomic way to load the query during a user interaction (for example when wanting to preload some data) that would otherwise be clunky with `useBackgroundQuery`. ```tsx function App() { const [loadQuery, queryRef, { refetch, fetchMore, reset }] = useLoadableQuery(query, options); return ( <> }> {queryRef && } ); } function Child({ queryRef }) { const { data } = useReadQuery(queryRef); // ... } ``` ##### Begin preloading outside of React with `createQueryPreloader` - [#​11412](https://togithub.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://togithub.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Add the ability to start preloading a query outside React to begin fetching as early as possible. Call `createQueryPreloader` to create a `preloadQuery` function which can be called to start fetching a query. This returns a `queryRef` which is passed to `useReadQuery` and suspended until the query is done fetching. ```tsx const preloadQuery = createQueryPreloader(client); const queryRef = preloadQuery(QUERY, { variables, ...otherOptions }); function App() { return { Loading
}> } } function MyQuery() { const { data } = useReadQuery(queryRef); // do something with data } ``` ##### Testing utility improvements - [#​11178](https://togithub.com/apollographql/apollo-client/pull/11178) [`4d64a6f`](https://togithub.com/apollographql/apollo-client/commit/4d64a6fa2ad5abe6f7f172c164f5e1fc2cb89829) Thanks [@​sebakerckhof](https://togithub.com/sebakerckhof)! - Support re-using of mocks in the MockedProvider - [#​6701](https://togithub.com/apollographql/apollo-client/pull/6701) [`8d2b4e1`](https://togithub.com/apollographql/apollo-client/commit/8d2b4e107d7c21563894ced3a65d631183b58fd9) Thanks [@​prowe](https://togithub.com/prowe)! - Ability to dynamically match mocks Adds support for a new property `MockedResponse.variableMatcher`: a predicate function that accepts a `variables` param. If `true`, the `variables` will be passed into the `ResultFunction` to help dynamically build a response. ##### New `useQueryRefHandlers` hook - [#​11412](https://togithub.com/apollographql/apollo-client/pull/11412) [`58db5c3`](https://togithub.com/apollographql/apollo-client/commit/58db5c3295b88162f91019f0898f6baa4b9cced6) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Create a new `useQueryRefHandlers` hook that returns `refetch` and `fetchMore` functions for a given `queryRef`. This is useful to get access to handlers for a `queryRef` that was created by `createQueryPreloader` or when the handlers for a `queryRef` produced by a different component are inaccessible. ```jsx const MyComponent({ queryRef }) { const { refetch, fetchMore } = useQueryRefHandlers(queryRef); // ... } ``` ##### Bail out of `optimisticResponse` updates with the `IGNORE` sentinel object - [#​11410](https://togithub.com/apollographql/apollo-client/pull/11410) [`07fcf6a`](https://togithub.com/apollographql/apollo-client/commit/07fcf6a3bf5bc78ffe6f3e598897246b4da02cbb) Thanks [@​sf-twingate](https://togithub.com/sf-twingate)! - Allow returning `IGNORE` sentinel object from `optimisticResponse` functions to bail-out from the optimistic update. Consider this example: ```jsx const UPDATE_COMMENT = gql` mutation UpdateComment($commentId: ID!, $commentContent: String!) { updateComment(commentId: $commentId, content: $commentContent) { id __typename content } } `; function CommentPageWithData() { const [mutate] = useMutation(UPDATE_COMMENT); return ( mutate({ variables: { commentId, commentContent }, optimisticResponse: (vars, { IGNORE }) => { if (commentContent === "foo") { // conditionally bail out of optimistic updates return IGNORE; } return { updateComment: { id: commentId, __typename: "Comment", content: commentContent, }, }; }, }) } /> ); } ``` The `IGNORE` sentinel can be destructured from the second parameter in the callback function signature passed to `optimisticResponse`. ##### Network adapters for multipart subscriptions usage with Relay and urql - [#​11301](https://togithub.com/apollographql/apollo-client/pull/11301) [`46ab032`](https://togithub.com/apollographql/apollo-client/commit/46ab032af83a01f184bfcce5edba4b55dbb2962a) Thanks [@​alessbell](https://togithub.com/alessbell)! - Add multipart subscription network adapters for Relay and urql ##### Relay ```tsx import { createFetchMultipartSubscription } from "@​apollo/client/utilities/subscriptions/relay"; import { Environment, Network, RecordSource, Store } from "relay-runtime"; const fetchMultipartSubs = createFetchMultipartSubscription( "http://localhost:4000", ); const network = Network.create(fetchQuery, fetchMultipartSubs); export const RelayEnvironment = new Environment({ network, store: new Store(new RecordSource()), }); ``` ##### Urql ```tsx import { createFetchMultipartSubscription } from "@​apollo/client/utilities/subscriptions/urql"; import { Client, fetchExchange, subscriptionExchange } from "@​urql/core"; const url = "http://localhost:4000"; const multipartSubscriptionForwarder = createFetchMultipartSubscription(url); const client = new Client({ url, exchanges: [ fetchExchange, subscriptionExchange({ forwardSubscription: multipartSubscriptionForwarder, }), ], }); ``` ##### `skipPollAttempt` callback function - [#​11397](https://togithub.com/apollographql/apollo-client/pull/11397) [`3f7eecb`](https://togithub.com/apollographql/apollo-client/commit/3f7eecbfbd4f4444cffcaac7dd9fd225c8c2a401) Thanks [@​aditya-kumawat](https://togithub.com/aditya-kumawat)! - Adds a new `skipPollAttempt` callback function that's called whenever a refetch attempt occurs while polling. If the function returns `true`, the refetch is skipped and not reattempted until the next poll interval. This will solve the frequent use-case of disabling polling when the window is inactive. ```ts useQuery(QUERY, { pollInterval: 1000, skipPollAttempt: () => document.hidden, // or !document.hasFocus() }); // or define it globally new ApolloClient({ defaultOptions: { watchQuery: { skipPollAttempt: () => document.hidden, // or !document.hasFocus() }, }, }); ``` ##### `QueryManager.inFlightLinkObservables` now uses a strong `Trie` as an internal data structure - [#​11345](https://togithub.com/apollographql/apollo-client/pull/11345) [`1759066`](https://togithub.com/apollographql/apollo-client/commit/1759066a8f9a204e49228568aef9446a64890ff3) Thanks [@​phryneas](https://togithub.com/phryneas)! ##### Warning: requires `@apollo/experimental-nextjs-app-support` update If you are using `@apollo/experimental-nextjs-app-support`, you will need to update that to at least 0.5.2, as it accesses this internal data structure.

More Minor Changes

- [#​11202](https://togithub.com/apollographql/apollo-client/pull/11202) [`7c2bc08`](https://togithub.com/apollographql/apollo-client/commit/7c2bc08b2ab46b9aa181d187a27aec2ad7129599) Thanks [@​benjamn](https://togithub.com/benjamn)! - Prevent `QueryInfo#markResult` mutation of `result.data` and return cache data consistently whether complete or incomplete. - [#​11442](https://togithub.com/apollographql/apollo-client/pull/11442) [`4b6f2bc`](https://togithub.com/apollographql/apollo-client/commit/4b6f2bccf3ba94643b38689b32edd2839e47aec1) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Remove the need to call `retain` from `useLoadableQuery` since `useReadQuery` will now retain the query. This means that a `queryRef` that is not consumed by `useReadQuery` within the given `autoDisposeTimeoutMs` will now be auto diposed for you. Thanks to [#​11412](https://togithub.com/apollographql/apollo-client/pull/11412), disposed query refs will be automatically resubscribed to the query when consumed by `useReadQuery` after it has been disposed. - [#​11438](https://togithub.com/apollographql/apollo-client/pull/11438) [`6d46ab9`](https://togithub.com/apollographql/apollo-client/commit/6d46ab930a5e9bd5cae153d3b75b8966784fcd4e) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Remove the need to call `retain` from `useBackgroundQuery` since `useReadQuery` will now retain the query. This means that a `queryRef` that is not consumed by `useReadQuery` within the given `autoDisposeTimeoutMs` will now be auto diposed for you. Thanks to [#​11412](https://togithub.com/apollographql/apollo-client/pull/11412), disposed query refs will be automatically resubscribed to the query when consumed by `useReadQuery` after it has been disposed. - [#​11175](https://togithub.com/apollographql/apollo-client/pull/11175) [`d6d1491`](https://togithub.com/apollographql/apollo-client/commit/d6d14911c40782cd6d69167b6f6169c890091ccb) Thanks [@​phryneas](https://togithub.com/phryneas)! - To work around issues in React Server Components, especially with bundling for the Next.js "edge" runtime we now use an external package to wrap `react` imports instead of importing React directly. - [#​11495](https://togithub.com/apollographql/apollo-client/pull/11495) [`1190aa5`](https://togithub.com/apollographql/apollo-client/commit/1190aa59a106217f7192c1f81099adfa5e4365c1) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Increase the default memory limits for `executeSelectionSet` and `executeSelectionSetArray`.

Patch Changes

- [#​11275](https://togithub.com/apollographql/apollo-client/pull/11275) [`3862f9b`](https://togithub.com/apollographql/apollo-client/commit/3862f9ba9086394c4cf4c2ecd99e8e0f6cf44885) Thanks [@​phryneas](https://togithub.com/phryneas)! - Add a `defaultContext` option and property on `ApolloClient`, e.g. for keeping track of changing auth tokens or dependency injection. This can be used e.g. in authentication scenarios, where a new token might be generated outside of the link chain and should passed into the link chain. ```js import { ApolloClient, createHttpLink, InMemoryCache } from "@​apollo/client"; import { setContext } from "@​apollo/client/link/context"; const httpLink = createHttpLink({ uri: "/graphql", }); const authLink = setContext((_, { headers, token }) => { return { headers: { ...headers, authorization: token ? `Bearer ${token}` : "", }, }; }); const client = new ApolloClient({ link: authLink.concat(httpLink), cache: new InMemoryCache(), }); // somewhere else in your application function onNewToken(newToken) { // token can now be changed for future requests without need for a global // variable, scoped ref or recreating the client client.defaultContext.token = newToken; } ``` - [#​11443](https://togithub.com/apollographql/apollo-client/pull/11443) [`ff5a332`](https://togithub.com/apollographql/apollo-client/commit/ff5a332ff8b190c418df25371e36719d70061ebe) Thanks [@​phryneas](https://togithub.com/phryneas)! - Adds a deprecation warning to the HOC and render prop APIs. The HOC and render prop APIs have already been deprecated since 2020, but we previously didn't have a `@deprecated` tag in the DocBlocks. - [#​11385](https://togithub.com/apollographql/apollo-client/pull/11385) [`d9ca4f0`](https://togithub.com/apollographql/apollo-client/commit/d9ca4f0821c66ae4f03cf35a7ac93fe604cc6de3) Thanks [@​phryneas](https://togithub.com/phryneas)! - ensure `defaultContext` is also used for mutations and subscriptions - [#​11503](https://togithub.com/apollographql/apollo-client/pull/11503) [`67f62e3`](https://togithub.com/apollographql/apollo-client/commit/67f62e359bc471787d066319326e5582b4a635c8) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Release changes from [`v3.8.10`](https://togithub.com/apollographql/apollo-client/releases/tag/v3.8.10) - [#​11078](https://togithub.com/apollographql/apollo-client/pull/11078) [`14edebe`](https://togithub.com/apollographql/apollo-client/commit/14edebebefb7634c32b921d02c1c85c6c8737989) Thanks [@​phryneas](https://togithub.com/phryneas)! - ObservableQuery: prevent reporting results of previous queries if the variables changed since - [#​11439](https://togithub.com/apollographql/apollo-client/pull/11439) [`33454f0`](https://togithub.com/apollographql/apollo-client/commit/33454f0a40a05ea2b00633bda20a84d0ec3a4f4d) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Address bundling issue introduced in [#​11412](https://togithub.com/apollographql/apollo-client/pull/11412) where the `react/cache` internals ended up duplicated in the bundle. This was due to the fact that we had a `react/hooks` entrypoint that imported these files along with the newly introduced `createQueryPreloader` function, which lived outside of the `react/hooks` folder. - [#​11371](https://togithub.com/apollographql/apollo-client/pull/11371) [`ebd8fe2`](https://togithub.com/apollographql/apollo-client/commit/ebd8fe2c1b8b50bfeb2da20aeca5671300fb5564) Thanks [@​phryneas](https://togithub.com/phryneas)! - Clarify types of `EntityStore.makeCacheKey`.
### [`v3.8.10`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#3810) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.9...v3.8.10) ##### Patch Changes - [#​11489](https://togithub.com/apollographql/apollo-client/pull/11489) [`abfd02a`](https://togithub.com/apollographql/apollo-client/commit/abfd02abeb8585e44377e9e87e5d20e5d95be002) Thanks [@​gronxb](https://togithub.com/gronxb)! - Fix `networkStatus` with `useSuspenseQuery` not properly updating to ready state when using a `cache-and-network` fetch policy that returns data equal to what is already in the cache. - [#​11483](https://togithub.com/apollographql/apollo-client/pull/11483) [`6394dda`](https://togithub.com/apollographql/apollo-client/commit/6394dda47fa83d9ddd922e0d05e62bd872e4ea8e) Thanks [@​pipopotamasu](https://togithub.com/pipopotamasu)! - Fix cache override warning output ### [`v3.8.9`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#389) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.8...v3.8.9) ##### Patch Changes - [#​11472](https://togithub.com/apollographql/apollo-client/pull/11472) [`afc844d`](https://togithub.com/apollographql/apollo-client/commit/afc844dd8d6f9f7a3e2003f9a5b541291dfe3fb4) Thanks [@​alessbell](https://togithub.com/alessbell)! - Fix delay: Infinity when set on a MockResponse passed to Mocked Provider so it indefinitely enters loading state. - [#​11464](https://togithub.com/apollographql/apollo-client/pull/11464) [`aac12b2`](https://togithub.com/apollographql/apollo-client/commit/aac12b221a6cb776d4941b6c8aadf04f0f0acd27) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Prevent `useFragment` from excessively unsubscribing and resubscribing the fragment with the cache on every render. - [#​11449](https://togithub.com/apollographql/apollo-client/pull/11449) [`f40cda4`](https://togithub.com/apollographql/apollo-client/commit/f40cda45841e93b056c781c19651b54464f7346a) Thanks [@​phryneas](https://togithub.com/phryneas)! - Removes refences to the typescript "dom" lib. - [#​11470](https://togithub.com/apollographql/apollo-client/pull/11470) [`e293bc9`](https://togithub.com/apollographql/apollo-client/commit/e293bc90d6f7937a6fc7c169f7b16eeb39d5fd49) Thanks [@​phryneas](https://togithub.com/phryneas)! - Remove an unnecessary check from parseAndCheckHttpResponse. ### [`v3.8.8`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#388) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.7...v3.8.8) ##### Patch Changes - [#​11200](https://togithub.com/apollographql/apollo-client/pull/11200) [`ae5091a21`](https://togithub.com/apollographql/apollo-client/commit/ae5091a21f0feff1486503071ea8dc002cf1be41) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Enable `strict` in tsconfig for the entire project. - [#​11332](https://togithub.com/apollographql/apollo-client/pull/11332) [`291aea56b`](https://togithub.com/apollographql/apollo-client/commit/291aea56bfaed3987a98be7fe4e6160114b62d2d) Thanks [@​asvishnyakov](https://togithub.com/asvishnyakov)! - Add missed reexports of MutationFetchPolicy and RefetchWritePolicy to @​apollo/client/core - [#​10931](https://togithub.com/apollographql/apollo-client/pull/10931) [`e5acf910e`](https://togithub.com/apollographql/apollo-client/commit/e5acf910e39752b453540b6751046d1c19b66350) Thanks [@​phryneas](https://togithub.com/phryneas)! - `useMutation`: also reset internal state on reset ### [`v3.8.7`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#387) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.6...v3.8.7) ##### Patch Changes - [#​11297](https://togithub.com/apollographql/apollo-client/pull/11297) [`c8c76a522`](https://togithub.com/apollographql/apollo-client/commit/c8c76a522e593de0d06cff73fde2d9e88152bed6) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Add an explicit return type for the `useReadQuery` hook called `UseReadQueryResult`. Previously the return type of this hook was inferred from the return value. - [#​11337](https://togithub.com/apollographql/apollo-client/pull/11337) [`bb1da8349`](https://togithub.com/apollographql/apollo-client/commit/bb1da8349e785c54fb4030f269602c900adf23a0) Thanks [@​phryneas](https://togithub.com/phryneas)! - [#​11206](https://togithub.com/apollographql/apollo-client/issues/11206) used the TypeScript syntax `infer X extends Y` that was introduced in TS 4.8. This caused some problems for some users, so we are rolling back to a more backwars-compatible (albeit slightly less performant) type. ### [`v3.8.6`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#386) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.5...v3.8.6) ##### Patch Changes - [#​11291](https://togithub.com/apollographql/apollo-client/pull/11291) [`2be7eafe3`](https://togithub.com/apollographql/apollo-client/commit/2be7eafe3c115d56d993dbda64d320550712df1f) Thanks [@​ArioA](https://togithub.com/ArioA)! - Fix a bug that allows to only call `loadErrorMessages` without also calling `loadDevErrorMessages`. - [#​11274](https://togithub.com/apollographql/apollo-client/pull/11274) [`b29f000f3`](https://togithub.com/apollographql/apollo-client/commit/b29f000f36f281e256809b5454eaeca2ec4450bf) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Start the query ref auto dispose timeout after the initial promise has settled. This prevents requests that run longer than the timeout duration from keeping the component suspended indefinitely. - [#​11289](https://togithub.com/apollographql/apollo-client/pull/11289) [`b5894dbf0`](https://togithub.com/apollographql/apollo-client/commit/b5894dbf0fd5ea5ef1ff20dd896a658ef78c69dc) Thanks [@​phryneas](https://togithub.com/phryneas)! - `MockedProvider`: default `connectToDevTools` to `false` in created `ApolloClient` instance. This will prevent the mocked `ApolloClient` instance from trying to connect to the DevTools, which would start a `setTimeout` that might keep running after a test has finished. - [#​11206](https://togithub.com/apollographql/apollo-client/pull/11206) [`dd2ce7687`](https://togithub.com/apollographql/apollo-client/commit/dd2ce7687ae9afa399e950a523fc7330284c25fe) Thanks [@​phryneas](https://togithub.com/phryneas)! - `cache.modify`: Less strict types & new dev runtime warnings. ### [`v3.8.5`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#385) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.4...v3.8.5) ##### Patch Changes - [#​11266](https://togithub.com/apollographql/apollo-client/pull/11266) [`5192cf6e1`](https://togithub.com/apollographql/apollo-client/commit/5192cf6e1e958080bcae09e5967fa6851bd3a78c) Thanks [@​phryneas](https://togithub.com/phryneas)! - Fixes argument handling for invariant log messages. - [#​11235](https://togithub.com/apollographql/apollo-client/pull/11235) [`6cddaaf65`](https://togithub.com/apollographql/apollo-client/commit/6cddaaf6543f5c0b1fb04ba47480fb393ba10de7) Thanks [@​phryneas](https://togithub.com/phryneas)! - Fix nextFetchPolicy behaviour with transformed documents by keeping `options` reference stable when passing it through QueryManager. - [#​11252](https://togithub.com/apollographql/apollo-client/pull/11252) [`327a2abbd`](https://togithub.com/apollographql/apollo-client/commit/327a2abbd5db87ca27f2ffd1d2f8dccd75868a58) Thanks [@​phryneas](https://togithub.com/phryneas)! - Fixes a race condition in asyncMap that caused issues in React Native when errors were returned in the response payload along with a data property that was null. - [#​11229](https://togithub.com/apollographql/apollo-client/pull/11229) [`c372bad4e`](https://togithub.com/apollographql/apollo-client/commit/c372bad4ebd01a4f2e772cd76e873143bf043fe6) Thanks [@​phryneas](https://togithub.com/phryneas)! - Remove (already throwing) SuspenseCache export that should have been removed in 3.8. - [#​11267](https://togithub.com/apollographql/apollo-client/pull/11267) [`bc055e068`](https://togithub.com/apollographql/apollo-client/commit/bc055e0683e87b9445e321f73857f4a91b20a9ce) Thanks [@​phryneas](https://togithub.com/phryneas)! - Remove some dead code. ### [`v3.8.4`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#384) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.3...v3.8.4) ##### Patch Changes - [#​11195](https://togithub.com/apollographql/apollo-client/pull/11195) [`9e59b251d`](https://togithub.com/apollographql/apollo-client/commit/9e59b251d4d63afb83d9821889f87c71c4adde0f) Thanks [@​phryneas](https://togithub.com/phryneas)! - For `invariant.log` etc., error arguments are now serialized correctly in the link to the error page. ### [`v3.8.3`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#383) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.2...v3.8.3) ##### Patch Changes - [#​11193](https://togithub.com/apollographql/apollo-client/pull/11193) [`fd2a4cf0c`](https://togithub.com/apollographql/apollo-client/commit/fd2a4cf0c3ada968df3f9814d87dedaaa8eddb5e) Thanks [@​phryneas](https://togithub.com/phryneas)! - Call devtools registration after ApolloClient is fully set up. ### [`v3.8.2`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#382) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.1...v3.8.2) ##### Patch Changes - [#​10072](https://togithub.com/apollographql/apollo-client/pull/10072) [`51045c336`](https://togithub.com/apollographql/apollo-client/commit/51045c336ff86befbdd598af6e7104ffe0d419d0) Thanks [@​Huulivoide](https://togithub.com/Huulivoide)! - Fixes race conditions in useReactiveVar that may prevent updates to the reactive variable from propagating through the hook. - [#​11162](https://togithub.com/apollographql/apollo-client/pull/11162) [`d9685f53c`](https://togithub.com/apollographql/apollo-client/commit/d9685f53c34483245e6ea21e91b669ef1180ae97) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Ensures GraphQL errors returned in subscription payloads adhere to the `errorPolicy` set in `client.subscribe(...)` calls. - [#​11134](https://togithub.com/apollographql/apollo-client/pull/11134) [`96492e142`](https://togithub.com/apollographql/apollo-client/commit/96492e14279d78e2613c1381d31f88cdf5816f45) Thanks [@​alessbell](https://togithub.com/alessbell)! - Use separate type imports in useSuspenseQuery and useBackgroundQuery to workaround SWC compiler issue. - [#​11117](https://togithub.com/apollographql/apollo-client/pull/11117) [`6b8198109`](https://togithub.com/apollographql/apollo-client/commit/6b8198109bd9fe5eedf352421a0a773ac0acfb18) Thanks [@​phryneas](https://togithub.com/phryneas)! - Adds a new devtools registration mechanism and tweaks the mechanism behind the "devtools not found" mechanic. - [#​11186](https://togithub.com/apollographql/apollo-client/pull/11186) [`f1d429f32`](https://togithub.com/apollographql/apollo-client/commit/f1d429f32ae8e896155b50f1fc7c51dfeb06c3ba) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Fix an issue where race conditions when rapidly switching between variables would sometimes result in the wrong `data` returned from the query. Specifically this occurs when a query is triggered with an initial set of variables (`VariablesA`), then triggers the same query with another set of variables (`VariablesB`) but switches back to the `VariablesA` before the response for `VariablesB` is returned. Previously this would result in the data for `VariablesB` to be displayed while `VariablesA` was active. The data is for `VariablesA` is now properly returned. - [#​11163](https://togithub.com/apollographql/apollo-client/pull/11163) [`a8a9e11e9`](https://togithub.com/apollographql/apollo-client/commit/a8a9e11e917716538206eb7d5de21dbfd09630bd) Thanks [@​bignimbus](https://togithub.com/bignimbus)! - Fix typo in error message: "occured" -> "occurred" - [#​11180](https://togithub.com/apollographql/apollo-client/pull/11180) [`7d9c481e5`](https://togithub.com/apollographql/apollo-client/commit/7d9c481e53f3c9577ec6ed6231c9e3db8c8b374b) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Fixes an issue where refetching from `useBackgroundQuery` via `refetch` with an error after an error was already fetched would get stuck in a loading state. ### [`v3.8.1`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#3810) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.8.0...v3.8.1) ##### Patch Changes - [#​11489](https://togithub.com/apollographql/apollo-client/pull/11489) [`abfd02a`](https://togithub.com/apollographql/apollo-client/commit/abfd02abeb8585e44377e9e87e5d20e5d95be002) Thanks [@​gronxb](https://togithub.com/gronxb)! - Fix `networkStatus` with `useSuspenseQuery` not properly updating to ready state when using a `cache-and-network` fetch policy that returns data equal to what is already in the cache. - [#​11483](https://togithub.com/apollographql/apollo-client/pull/11483) [`6394dda`](https://togithub.com/apollographql/apollo-client/commit/6394dda47fa83d9ddd922e0d05e62bd872e4ea8e) Thanks [@​pipopotamasu](https://togithub.com/pipopotamasu)! - Fix cache override warning output ### [`v3.8.0`](https://togithub.com/apollographql/apollo-client/blob/HEAD/CHANGELOG.md#380) [Compare Source](https://togithub.com/apollographql/apollo-client/compare/v3.7.17...v3.8.0) ##### Minor Changes ##### Fetching with Suspense ๐ŸŽ‰ - [#​10323](https://togithub.com/apollographql/apollo-client/pull/10323) [`64cb88a4b`](https://togithub.com/apollographql/apollo-client/commit/64cb88a4b6be8640c4e0d753dd06ddf4c25a2bc3) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Add support for React suspense with a new `useSuspenseQuery` hook. `useSuspenseQuery` initiates a network request and causes the component calling it to suspend while the request is in flight. It can be thought of as a drop-in replacement for `useQuery` that allows you to take advantage of React's concurrent features while fetching during render. Consider a `Dog` component that fetches and renders some information about a dog named Mozzarella:
View code ๐Ÿถ ```tsx import { Suspense } from "react"; import { gql, TypedDocumentNode, useSuspenseQuery } from "@​apollo/client"; interface Data { dog: { id: string; name: string; }; } interface Variables { name: string; } const GET_DOG_QUERY: TypedDocumentNode = gql` query GetDog($name: String) { dog(name: $name) { id name } } `; function App() { return ( Loading...
}> ); } function Dog({ name }: { name: string }) { const { data } = useSuspenseQuery(GET_DOG_QUERY, { variables: { name }, }); return <>Name: {data.dog.name}; } ``` For a detailed explanation of `useSuspenseQuery`, see our [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense). - [#​10755](https://togithub.com/apollographql/apollo-client/pull/10755) [`e3c676deb`](https://togithub.com/apollographql/apollo-client/commit/e3c676deb59d006f33d24a7211e58725a67641b8) Thanks [@​alessbell](https://togithub.com/alessbell)! - Feature: adds `useBackgroundQuery` and `useReadQuery` hooks `useBackgroundQuery` initiates a request for data in a parent component and returns a `QueryReference` which is used to read the data in a child component via `useReadQuery`. If the child component attempts to render before the data can be found in the cache, the child component will suspend until the data is available. On cache updates to watched data, the child component calling `useReadQuery` will re-render with new data **but the parent component will not re-render** (as it would, for example, if it were using `useQuery` to issue the request). Consider an `App` component that fetches a list of breeds in the background while also fetching and rendering some information about an individual dog, Mozzarella:
View code ๐Ÿถ ```tsx function App() { const [queryRef] = useBackgroundQuery(GET_BREEDS_QUERY); return ( Loading...}> ); } function Dog({ name, queryRef, }: { name: string; queryRef: QueryReference; }) { const { data } = useSuspenseQuery(GET_DOG_QUERY, { variables: { name }, }); return ( <> Name: {data.dog.name} Loading breeds...}> ); } function Breeds({ queryRef }: { queryRef: QueryReference }) { const { data } = useReadQuery(queryRef); return data.breeds.map(({ characteristics }) => characteristics.map((characteristic) => (
{characteristic}
)), ); } ```
For a detailed explanation of `useBackgroundQuery` and `useReadQuery`, see our [fetching with Suspense reference](https://www.apollographql.com/docs/react/data/suspense). ##### Document transforms ๐Ÿ“‘ - [#​10509](https://togithub.com/apollographql/apollo-client/pull/10509) [`79df2c7ba`](https://togithub.com/apollographql/apollo-client/commit/79df2c7ba55b7cfee69fd54024174f77099a2550) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Add the ability to specify custom GraphQL document transforms. These transforms are run before reading data from the cache, before local state is resolved, and before the query document is sent through the link chain. To register a custom document transform, create a transform using the `DocumentTransform` class and pass it to the `documentTransform` option on `ApolloClient`. ```ts import { DocumentTransform } from "@​apollo/client"; const documentTransform = new DocumentTransform((document) => { // do something with `document` return transformedDocument; }); const client = new ApolloClient({ documentTransform: documentTransform }); ``` For more information on the behavior and API of `DocumentTransform`, see its [reference page in our documentation](https://www.apollographql.com/docs/react/data/document-transforms). ##### New `removeTypenameFromVariables` link ๐Ÿ”— - [#​10853](https://togithub.com/apollographql/apollo-client/pull/10853) [`300957960`](https://togithub.com/apollographql/apollo-client/commit/300957960a584920f2d346d29a0b3aaeb27d9489) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Introduce the new `removeTypenameFromVariables` link. This link will automatically remove `__typename` fields from `variables` for all operations. This link can be configured to exclude JSON-scalars for scalars that utilize `__typename`. This change undoes some work from [#​10724](https://togithub.com/apollographql/apollo-client/pull/10724) where `__typename` was automatically stripped for all operations with no configuration. This was determined to be a breaking change and therefore moved into this link. For a detailed explanation of `removeTypenameFromVariables`, see its [API reference](https://www.apollographql.com/docs/react/api/link/apollo-link-remove-typename). ##### New `skipToken` sentinel โญ๏ธ - [#​11112](https://togithub.com/apollographql/apollo-client/pull/11112) [`b4aefcfe9`](https://togithub.com/apollographql/apollo-client/commit/b4aefcfe97213461b9ce01946344e6a5e6d80704) Thanks [@​jerelmiller](https://togithub.com/jerelmiller)! - Adds support for a `skipToken` sentinel that can be used as `options` in `useSuspenseQuery` and `useBackgroundQuery` to skip execution of a query. This works identically to the `skip` option but is more type-safe and as such, becomes the recommended way to skip query execution. As such, the `skip` option has been deprecated in favor of `skipToken`. We are considering the removal of the `skip` option from `useSuspenseQuery` and `useBackgroundQuery` in the next major. We are releasing with it now to make migration from `useQuery` easier and make `skipToken` more discoverable. **`useSuspenseQuery`** ```ts import { skipToken, useSuspenseQuery } from "@​apollo/client"; const id: number | undefined; const { data } = useSuspenseQuery( query, id ? { variables: { id } } : skipToken, ); ``` **`useBackgroundQuery`** ```ts import { skipToken, useBackgroundQuery } from "@​apollo/client"; function Parent() { const [queryRef] = useBackgroundQuery( query, id ? { variables: { id } } : skipToken ); return queryRef ? : null; } function Child({ queryRef }: { queryRef: QueryReference }) { const { data } = useReadQuery(queryRef); } ``` For a detailed explanation of `skipToken`, see its [API reference](https://www.apollographql.com/docs/react/api/react/hooks/#skiptoken). ##### New error extraction mechanism, smaller bundles ๐Ÿ“‰ - [#​10887](https://togithub.com/apollographql/apollo-client/pull/10887) [`f8c0b965d`](https://togithub.com/apollographql/apollo-client/commit/f8c0b965d49fb7d802371bb9cc3cb0b60cf05e5d) Thanks [@​phryneas](https://togithub.com/phryneas)! - Add a new mechanism for Error Extraction to reduce bundle size by including error message texts on an opt-in basis. By default, errors will link to an error page with the entire error message. This replaces "development" and "production" errors and works without additionalย bundler configuration. Bundling the text of error messages and development warnings can be enabled as follows: ```js import { loadErrorMessages, loadDevMessages } from "@​apollo/client/dev"; if (process.env.NODE_ENV !== "production") { loadErrorMessages(); loadDevMessages(); } ``` For a detailed explanation, see our [reference on reducing bundle size](https://www.apollographql.com/docs/react/development-testing/reducing-bundle-size). ##### New `@nonreactive` directive ๐ŸŽฌ - [#​10722](https://togithub.com/apollographql/apollo-client/pull/10722) [`c7e60f83d`](https://togithub.com/apollographql/apollo-client/commit/c7e60f83dd1dfe07a1b6ce60d9675d3616a2ce66) Thanks [@​benjamn](https://togithub.com/benjamn)! - Implement a `@nonreactive` directive for selectively skipping reactive comparisons of query result subtrees. The `@nonreactive` directive can be used to mark query fields or fragment spreads and is used to indicate that changes to the data contained within the subtrees marked `@nonreactive` should *not* trigger re-rendering. This allows parent components to fetch data to be rendered by their children without re-rendering themselves when the data corresponding with fields marked as `@nonreactive` change. Consider an `App` component that fetches and renders a list of ski trails:
View code ๐ŸŽฟ ```jsx const TrailFragment = gql` fragment TrailFragment on Trail { name status } `; const ALL_TRAILS = gql` query allTrails { allTrails { id ...TrailFragment @​nonreactive } } ${TrailFragment} `; function App() { const { data, loading } = useQuery(ALL_TRAILS); return (

Ski Trails

    {data?.trails.map((trail) => ( ))}
); } ```
The `Trail` component renders a trail's name and status and allows the user to execute a mutation to toggle the status of the trail between `"OPEN"` and `"CLOSED"`:
View code ๐ŸŽฟ ```jsx const Trail = ({ id }) => { const [updateTrail] = useMutation(UPDATE_TRAIL); const { data } = useFragment({ fragment: TrailFragment, from: { __typename: "Trail", id, }, }); return (
  • {data.name} - {data.status} { updateTrail({ variables: { trailId: id, status: e.target.checked ? "OPEN" : "CLOSED", }, }); }} />
  • ); }; ```
    Notice that the `Trail` component isn't receiving the entire `trail` object via props, only the `id` which is used along with the fragment document to create a live binding for each trail item in the cache. This allows each `Trail` component to react to the cache updates for a single trail independently. Updates to a trail's `status` will not cause the parent `App` component to rerender since the `@nonreactive` directive is applied to the `TrailFragment` spread, a fragment that includes the `status` field. For a detailed explanation, see our [`@nonreactive` reference](https://www.apollographql.com/docs/react/data/directives/#nonreactive) and [@​alessbell](https://togithub.com/alessbell)'s [post on the Apollo blog about using `@nonreactive` with `useFragment`](https://www.apollographql.com/blog/apollo-client/introducing-apollo-clients-nonreactive-directive-and-usefragment-hook/). ##### Abort the `AbortController` signal more granularly ๐Ÿ›‘ - [#​11040](https://togithub.com/apollographql/apollo-client/pull/11040) [`125ef5b2a`](https://togithub.com/apollographql/apollo-client/commit/125ef5b2a8fd2de1515b2bdd71785ebab3596cb2) Thanks [@​phryneas](https://togithub.com/phryneas)! - `HttpLink`/`BatchHttpLink`: Abort the `AbortController` signal more granularly. Before this change, when `HttpLink`/`BatchHttpLink` created an `AbortController` internally, the signal would always be `.abort`ed after the request was completed. This could cause issues with Sentry Session Replay and Next.js App Router Cache invalidations, which just replayed the fetch with the same options - including the cancelled `AbortSignal`. With this change, the `AbortController` will only be `.abort()`ed by outside events, not as a consequence of the request completing. ##### `useFragment` drops its experimental label ๐ŸŽ“ - [#​10916](https://togithub.com/apollographql/apollo-client/pull/10916) [`ea75e18de`](https://togithub.com/apollographql/apollo-client/commit/ea75e18dec3db090dd4ed3b2d249bf674b90ead4) Thanks [@​alessbell](https://togithub.com/alessbell)! - Remove experimental labels. `useFragment`, introduced in `3.7.0` as `useFragment_experimental`, is no longer an experimental API ๐ŸŽ‰ We've removed the `_experimental` suffix from its named export and have made a number of improvements. For a detailed explanation, see our [`useFragment` reference](https://www.apollographql.com/docs/react/api/react/hooks#usefragment) and [@​alessbell](https://togithub.com/alessbell)'s [post on the Apollo blog](https://www.apollographql.com/blog/apollo-client/introducing-apollo-clients-nonreactive-directive-and-usefragment-hook/) about using `useFragment` with `@nonreactive` for improved performance when rendering lists.
    useFragment improvements
    - [#​10765](https://togithub.com/apollographql/apollo-client/pull/10765) [`35f36c5aa`](https://togithub.com/apollographql/apollo-client/commit/35f36c5aaefe1f215044e09fdf9386042bc59dd2) Thanks [@​phryneas](https://togithub.com/phryneas)! - More robust types for the `data` property on `UseFragmentResult`. When a partial result is given, the type is now correctly set to `Partial`. - [#​11083](https://togithub.com/apollographql/apollo-client/pull/11083) [`f766e8305`](https://togithub.com/apollographql/apollo-client/commit/f766e8305d9f2dbde59a61b8e70c99c4b2b67d55) Thanks [@​phryneas](https://togithub.com/phryneas)! - Adjust the rerender timing of `useQuery` to more closely align with `useFragment`. This means that cache updates delivered to both hooks should trigger renders at relatively the same time. Previously, the `useFragment` might rerender much faster leading to some confusion. - [#​10836](https://togithub.com/apollographql/apollo-client/pull/10836) [`6794893c2`](https://togithub.com/apollographql/apollo-client/commit/6794893c29cc945aa99f6fe54a9e4e70ec3e57fd) Thanks [@​phryneas](https://togithub.com/phryneas)! - Remove the deprecated `returnPartialData` option from `useFragment` hook.

    More Minor Changes

    - [#​10895](https://togithub.com/apollographql/apollo-client/pull/10895) [`e187866fd`](https://togithub.com/apollographql/apollo-client/commit/e187866fdfbbd1e1e30646f289367fb4b5afb3c3) Thanks [@​Gelio](https://togithub.com/Gelio)! - Add generic type parameter for the entity modified in `cache.modify`. Improves TypeScript type inference for that type's fields and values of those fields. Example: ```ts cache.modify({ id: cache.identify(someBook), fields: { title: (title) => { // title has type `string`. // It used to be `any`. }, => { // author has type `Reference | Book["author"]`. // It used to be `any`. }, }, }); ``` - [#​10895](https://togithub.com/apollog
    --- ### Configuration ๐Ÿ“… **Schedule**: Branch creation - At any time (no schedule defined), Automerge - "after 8am and before 4pm on tuesday" in timezone Etc/UTC. ๐Ÿšฆ **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 has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate).