@apollo/client
4.3.5 · 19 Oct 2026MIT5.3M / weekRepositoryHomepagenpmAtom feed
3.14.1 is the newest release of 3.x.
In short
7 new1 fixed3 changed
Release note
Apollo Client 3.6.0 (2022-04-26)
Potentially disruptive changes
Calling
fetchMorefor queries using thecache-and-networkornetwork-onlyfetch policies will no longer trigger additional network requests when cache results are complete. Instead, those complete cache results will be delivered as if using thecache-firstfetch policy.
@benjamn in #9504Reimplement
useQueryanduseLazyQueryto use the proposeduseSyncExternalStoreAPI from React 18.
@brainkim and @benjamn in #8785 and #9596Fixed bug where the
useLazyQueryexecution function would always use therefetchmethod ofObservableQuery, instead of properly reapplying the currentfetchPolicyusing thereobservemethod.
@benjamn in #9564Since this
reobservemethod is useful and used internally, we have now exposed it asuse[Lazy]Query(...).reobserve(which optionally takes aPartial<WatchQueryOptions>of new options), to supplement the existingrefetchmethod. Note thatreobservepermanently updates thevariablesand other options of theObservableQuery, unlikerefetch({ ...variables }), which does not save thosevariables.The internal use of
options.fetchBlockingPromisebyuseQueryanduseLazyQuerymay slightly delay the delivery of network results, compared to previous versions of Apollo Client. Since network results are already delivered asynchronously, these timing differences should not be disruptive in most cases. Nevertheless, please open an issue if the timing differences are a problem for you (and you have no easy workaround).
@benjamn in #9599
React 18
In both its peerDependencies and its internal implementation, Apollo Client v3.6 should no longer prevent you from updating to React 18 in your applications.
Internally, we have refactored useQuery and useLazyQuery to be implemented in terms of React's new (shimmable) useSyncExternalStore hook, demonstrating Apollo Client can serve as an external store with a referentially stable, synchronous API, as needed by React.
As part of this refactoring, we also improved the behavior of useQuery and useLazyQuery when used in <React.StrictMode>, which double-renders components in development. While this double-rendering always results in calling useQuery twice, forcing Apollo Client to create and then discard an unnecessary ObservableQuery object, we now have multiple defenses in place against executing any network queries for the unused ObservableQuery objects.
In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling our server-side rendering utilities (getDataFromTree et al.), and introducing suspenseful versions of our hooks, to take full advantage of the new patterns React 18+ enables for data management libraries like Apollo Client.
Improvements
Allow
BatchLinkto cancel queued and in-flight operations.
@PowerKiKi and @benjamn in #9248Add
GraphQLWsLinkin@apollo/client/link/subscriptions. This link is similar to the existingWebSocketLinkin@apollo/client/link/ws, but uses the newergraphql-wspackage and protocol instead of the oldersubscriptions-transport-wsimplementation. This functionality was technically first released in@apollo/client@3.5.10, but semantically belongs in the 3.6.0 minor version.
@glasser in #9369Allow passing
defaultOptionstouseQueryto avoid clobbering/resetting existing options whenuseQueryis called repeatedly.
@benjamn in #9563, superseding #9223Provide additional context to
nextFetchPolicyfunctions to assist withfetchPolicytransitions. More details can be found in thenextFetchPolicydocumentation.
@benjamn in #9222Remove nagging deprecation warning about passing an
options.updateQueryfunction tofetchMore.
@benjamn in #9504Let
addTypenameToDocumenttake anyASTNode(includingDocumentNode, as before).
@benjamn in #9595Set
useMutationinternalisMountedvariable totrueagain when component remounted.
@devpeerapong in #9561