-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dependency @apollo/client to v3.9.5 #10087
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renovate
bot
changed the title
fix(deps): update dependency @apollo/client to v3.9.5
Update dependency @apollo/client to v3.9.5
Mar 3, 2024
ahaywood
added
fixture-ok
Override the test project fixture check
changelog-ok
release:chore
This PR is a chore (means nothing for users)
labels
Mar 5, 2024
ahaywood
pushed a commit
that referenced
this pull request
Mar 5, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@apollo/client](https://www.apollographql.com/docs/react/) ([source](https://togithub.com/apollographql/apollo-client)) | [`3.8.10` -> `3.9.5`](https://renovatebot.com/diffs/npm/@apollo%2fclient/3.8.10/3.9.5) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@apollo%2fclient/3.9.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@apollo%2fclient/3.9.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@apollo%2fclient/3.8.10/3.9.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@apollo%2fclient/3.8.10/3.9.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- <details> <summary>apollographql/apollo-client (@​apollo/client)</summary> [`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) - [#​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) - [#​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) - [#​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) - [#​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) - [#​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) - [#​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` `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 ( <> <button onClick={() => loadQuery(variables)}>Load query</button> <Suspense fallback={<SuspenseFallback />}> {queryRef && <Child queryRef={queryRef} />} </Suspense> </> ); } function Child({ queryRef }) { const { data } = useReadQuery(queryRef); // ... } ``` - [#​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. - [#​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. - [#​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); // ... } ``` 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 ( <Comment updateComment={({ commentId, commentContent }) => 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`. ```tsx const preloadQuery = createQueryPreloader(client); const queryRef = preloadQuery(QUERY, { variables, ...otherOptions }); function App() { return { <Suspense fallback={<div>Loading</div>}> <MyQuery /> </Suspense> } } function MyQuery() { const { data } = useReadQuery(queryRef); // do something with data } ``` 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, }), ], }); ``` - [#​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() }, }, }); ``` 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)! 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. <details open> <summary><h4>More Minor Changes</h4></summary> - [#​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`. </details> <details open> <summary><h3>Patch Changes</h3></summary> - [#​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`. </details> </details> --- 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/redwoodjs/redwood). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMjAuMiIsInVwZGF0ZWRJblZlciI6IjM3LjIyMC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
dac09
added a commit
that referenced
this pull request
Mar 6, 2024
…support * 'main' of github.com:redwoodjs/redwood: (30 commits) fix(scenario): Make sure to cleanup even if test fails (#10112) Update babel monorepo to v7.24.0 (#10090) Update storybook monorepo to v7.6.17 (#10089) Update dependency @apollo/client to v3.9.5 (#10087) fix(serve): Allow periods in most paths (#10114) feat(rsc-streaming): Integrating RSC builds with Streaming and Client side hydration (#10031) chore(style): getDefaultViteConfig source format (#10111) chore(refactor): vite - extract default vite config (#10110) chore(comment): cli index FIXME comment about ugly big red box RSC: rscBuildAnalyze: Start at web/src/ (#10109) RSC: ensureProcessDirWeb() (#10108) RSC: Extract webpack shims into their own file (#10107) RSC: Remove completed TODO comment RSC: Babel react plugin not needed for analyze phase (#10106) RSC: runFeServer: wrap RSC code with `if (rscEnabled)` (#10105) RSC: Update comments, naming etc based on Danny's input (#10104) RSC: Rename to buildRscClientAndServer (#10103) RSC: Rename to rscBuildForServer, and tweak some comments (#10102) SSR: Extract buildForStreamingServer function (#10099) chore(unit-tests): Silence middleware error logging (#10097) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
fixture-ok
Override the test project fixture check
release:chore
This PR is a chore (means nothing for users)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
3.8.10
->3.9.5
Release Notes
apollographql/apollo-client (@apollo/client)
v3.9.5
Compare Source
Patch Changes
#11595
8c20955
Thanks @phryneas! - Bumps the dependencyrehackt
to 0.0.5#11592
1133469
Thanks @Stephen2! - StrengthenMockedResponse.newData
type#11579
1ba2fd9
Thanks @jerelmiller! - Fix issue where partial data is reported touseQuery
when usingnotifyOnNetworkStatusChange
after it errors while another overlapping query succeeds.#11579
1ba2fd9
Thanks @jerelmiller! - Fix an issue where a partial cache write for an errored query would result in automatically refetching that query.#11562
65ab695
Thanks @mspiess! - Mocks with an infinite delay no longer require result or errorv3.9.4
Compare Source
Patch Changes
#11403
b0c4f3a
Thanks @jerelmiller! - Fix issue inuseLazyQuery
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
e855d00
Thanks @alessbell! - Revert PR #11202 to fix caching bug reported in #11560v3.9.3
Compare Source
Patch Changes
#11525
dce923a
Thanks @vezaynk! - Allows passing in client via options to useFragment#11558
8cba16f
Thanks @alessbell! - Fixunbound-method
linter error on ObservableQuery methods exposed on useQuery's QueryResult object.v3.9.2
Compare Source
Patch Changes
6ac2b0c
Thanks @jerelmiller! - Fix import inuseLazyRef
causing import issues in the nextjs package.v3.9.1
Compare Source
Patch Changes
#11516
8390fea
Thanks @phryneas! - Fix an incorrect string substitution in a warning message.#11515
c9bf93b
Thanks @vladar! - Avoid redundant refetchQueries call for mutation with no-cache policy (fixes #10238)#11545
84a6bea
Thanks @alessbell! - Remove error thrown byinFlightLinkObservables
intended to be removed before 3.9 release.v3.9.0
Compare Source
Minor Changes
Memory optimizations
#11424
62f3b6d
Thanks @phryneas! - Simplify RetryLink, fix potential memory leakHistorically,
RetryLink
would keep avalues
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) 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 thatConcast
would handle subscribers on its own.#11435
5cce53e
Thanks @phryneas! - DeprecatescanonizeResults
.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
d08970d
Thanks @benjamn! - DecouplecanonicalStringify
fromObjectCanon
for better time and memory performance.#11356
cc4ac7e
Thanks @phryneas! - Fix a potential memory leak inFragmentRegistry.transform
andFragmentRegistry.findFragmentSpreads
that would hold on to passed-inDocumentNodes
for too long.#11370
25e2cb4
Thanks @phryneas! -parse
function: improve memory managementWeakCache
instead ofMap
to keep a limited number of parsed resultsparse.resetCache()
method#11389
139acd1
Thanks @phryneas! -documentTransform
: useoptimism
andWeakCache
instead of directly storing data on theTrie
#11358
7d939f8
Thanks @phryneas! - Fixes a potential memory leak inConcast
that might have been triggered whenConcast
was used outside of Apollo Client.#11344
bd26676
Thanks @phryneas! - Add aresetCache
method toDocumentTransform
and hookInMemoryCache.addTypenameTransform
up toInMemoryCache.gc
#11367
30d17bf
Thanks @phryneas! -print
: useWeakCache
instead ofWeakMap
#11387
4dce867
Thanks @phryneas! -QueryManager.transformCache
: useWeakCache
instead ofWeakMap
#11369
2a47164
Thanks @phryneas! - Persisted Query Link: improve memory managementWeakCache
instead ofWeakMap
to keep a limited number of hash resultspersistedLink.resetHashCache()
method#10804
221dd99
Thanks @phryneas! - use WeakMap in React Native with Hermes#11355
7d8e184
Thanks @phryneas! - InMemoryCache.gc now also triggers FragmentRegistry.resetCaches (if there is a FragmentRegistry)#11409
2e7203b
Thanks @phryneas! - Adds an experimentalApolloClient.getMemoryInternals
helper#11343
776631d
Thanks @phryneas! - Addreset
method toprint
, hook up toInMemoryCache.gc
Suspense-enabled data fetching on user interaction with
useLoadableQuery
#11300
a815873
Thanks @jerelmiller! - Introduces a newuseLoadableQuery
hook. This hook works similarly touseBackgroundQuery
in that it returns aqueryRef
that can be used to suspend a component via theuseReadQuery
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 withuseBackgroundQuery
.Begin preloading outside of React with
createQueryPreloader
58db5c3
Thanks @jerelmiller! - Add the ability to start preloading a query outside React to begin fetching as early as possible. CallcreateQueryPreloader
to create apreloadQuery
function which can be called to start fetching a query. This returns aqueryRef
which is passed touseReadQuery
and suspended until the query is done fetching.Testing utility improvements
#11178
4d64a6f
Thanks @sebakerckhof! - Support re-using of mocks in the MockedProvider#6701
8d2b4e1
Thanks @prowe! - Ability to dynamically match mocksAdds support for a new property
MockedResponse.variableMatcher
: a predicate function that accepts avariables
param. Iftrue
, thevariables
will be passed into theResultFunction
to help dynamically build a response.New
useQueryRefHandlers
hook#11412
58db5c3
Thanks @jerelmiller! - Create a newuseQueryRefHandlers
hook that returnsrefetch
andfetchMore
functions for a givenqueryRef
. This is useful to get access to handlers for aqueryRef
that was created bycreateQueryPreloader
or when the handlers for aqueryRef
produced by a different component are inaccessible.Bail out of
optimisticResponse
updates with theIGNORE
sentinel object#11410
07fcf6a
Thanks @sf-twingate! - Allow returningIGNORE
sentinel object fromoptimisticResponse
functions to bail-out from the optimistic update.Consider this example:
The
IGNORE
sentinel can be destructured from the second parameter in the callback function signature passed tooptimisticResponse
.Network adapters for multipart subscriptions usage with Relay and urql
#11301
46ab032
Thanks @alessbell! - Add multipart subscription network adapters for Relay and urqlRelay
Urql
skipPollAttempt
callback function#11397
3f7eecb
Thanks @aditya-kumawat! - Adds a newskipPollAttempt
callback function that's called whenever a refetch attempt occurs while polling. If the function returnstrue
, 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.QueryManager.inFlightLinkObservables
now uses a strongTrie
as an internal data structure#11345
1759066
Thanks @phryneas!Warning: requires
@apollo/experimental-nextjs-app-support
updateIf 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
7c2bc08
Thanks @benjamn! - PreventQueryInfo#markResult
mutation ofresult.data
and return cache data consistently whether complete or incomplete.#11442
4b6f2bc
Thanks @jerelmiller! - Remove the need to callretain
fromuseLoadableQuery
sinceuseReadQuery
will now retain the query. This means that aqueryRef
that is not consumed byuseReadQuery
within the givenautoDisposeTimeoutMs
will now be auto diposed for you.Thanks to #11412, disposed query refs will be automatically resubscribed to the query when consumed by
useReadQuery
after it has been disposed.#11438
6d46ab9
Thanks @jerelmiller! - Remove the need to callretain
fromuseBackgroundQuery
sinceuseReadQuery
will now retain the query. This means that aqueryRef
that is not consumed byuseReadQuery
within the givenautoDisposeTimeoutMs
will now be auto diposed for you.Thanks to #11412, disposed query refs will be automatically resubscribed to the query when consumed by
useReadQuery
after it has been disposed.#11175
d6d1491
Thanks @phryneas! - To work around issues in React Server Components, especially with bundling forthe Next.js "edge" runtime we now use an external package to wrap
react
importsinstead of importing React directly.
#11495
1190aa5
Thanks @jerelmiller! - Increase the default memory limits forexecuteSelectionSet
andexecuteSelectionSetArray
.Patch Changes
#11275
3862f9b
Thanks @phryneas! - Add adefaultContext
option and property onApolloClient
, 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.
#11443
ff5a332
Thanks @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
d9ca4f0
Thanks @phryneas! - ensuredefaultContext
is also used for mutations and subscriptions#11503
67f62e3
Thanks @jerelmiller! - Release changes fromv3.8.10
#11078
14edebe
Thanks @phryneas! - ObservableQuery: prevent reporting results of previous queries if the variables changed since#11439
33454f0
Thanks @jerelmiller! - Address bundling issue introduced in #11412 where thereact/cache
internals ended up duplicated in the bundle. This was due to the fact that we had areact/hooks
entrypoint that imported these files along with the newly introducedcreateQueryPreloader
function, which lived outside of thereact/hooks
folder.#11371
ebd8fe2
Thanks @phryneas! - Clarify types ofEntityStore.makeCacheKey
.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ 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 Mend Renovate. View repository job log here.