@apollo/client
4.3.5 · 19 Oct 2026MIT5.3M / weekRepositoryHomepagenpmAtom feed
3.14.1 is the newest release of 3.x.
In short
14 new6 fixed
Release note
Apollo Client 3.5.0 (2021-11-08)
Improvements
Add
updateQueryandupdateFragmentmethods toApolloCache, simplifying commonreadQuery/writeQuerycache update patterns.
@wassim-k in #8382Field directives and their arguments can now be included along with field argument names when using field policy
keyArgs: [...]notation. For example, if you have aQuery.feedfield that takes an argument calledtypeand uses a@connection(key:...)directive to keepfeeddata from different queries separate within the cache, you might configure both using the followingInMemoryCachefield policy:new InMemoryCache({ typePolicies: { Query: { fields: { feed: { keyArgs: ["type", "@connection", ["key"]], }, }, }, }, });Report single
MissingFieldErrorinstead of a potentially very largeMissingFieldErrorarray for incomplete cache reads, improving performance and memory usage.
@benjamn in #8734When writing results into
InMemoryCache, each written object is now identified usingpolicies.identifyafter traversing the fields of the object (rather than before), simplifying identification and reducing duplicate work. If you have customkeyFieldsfunctions, they still receive the raw result object as their first parameter, but theKeyFieldsContextparameter now providescontext.storeObject(theStoreObjectjust processed byprocessSelectionSet) andcontext.readField(a helper function for reading fields fromcontext.storeObjectand anyReferences it might contain, similar toreadFieldforread,merge, andcache.modifyfunctions).
@benjamn in #8996Ensure
cache.identifynever throws when primary key fields are missing, and include the source object in the error message whenkeyFieldsprocessing fails.
@benjamn in #8679The
HttpLinkconstructor now accepts an optionalprintfunction that can be used to customize how GraphQLDocumentNodeobjects are transformed back into strings before they are sent over the network.
@sarahgp in #8699Make
@apollo/client/testinga fully-fledged, independent entry point, instead of re-exporting@apollo/client/utilities/testing(which was never an entry point and no longer exists).
@benjamn in #8769A new nested entry point called
@apollo/client/testing/corehas been created. Importing from this entry point instead of@apollo/client/testingexcludes any React-related dependencies.
@wassim-k in #8687Make
cache.batchreturn the result of calling theoptions.updatefunction.
@benjamn in #8696The
NetworkErrorandErrorResponsetypes have been changed to align more closely.
@korywka in #8424Update
zen-observable-tsto eliminate transitive dependency on@types/zen-observable.
@benjamn in #8695
React Refactoring
Improvements (due to @brainkim in #8875)
The
useLazyQueryfunction now returns a promise with the result.The
useMutationresult now exposes a method which can be reset.
Bug Fixes (due to @brainkim in #8596)
The
useQueryanduseLazyQueryhooks will now haveObservableQuerymethods defined consistently.Calling
useLazyQuerymethods likestartPollingwill start the query.Calling the
useLazyQueryexecution function will now behave more likerefetch.previousDatawill be preserved.standbyfetchPolicies will now act likeskip: truemore consistently.Calling
refetchon a skipped query will have no effect (issue #8270).Prevent
onErrorandonCompletedfunctions from firing continuously, and improving their polling behavior.