@apollo/client
4.3.5 · 19 Oct 2026MIT5.3M / weekRepositoryHomepagenpmAtom feed
3.14.1 is the newest release of 3.x.
In short
2 breaking1 removed2 deprecated14 new3 fixed
- breaking
Changes usages of the
GraphQLErrortype toGraphQLFormattedError. - breaking
Call
nextFetchPolicywith "variables-changed" even if there is afetchPolicyspecified. - removed
Remove deprecated
watchFragmentoption,canonizeResults - deprecated
Deprecates experimental schema testing utilities introduced in 3.10 in favor of recommending
@apollo/graphql-testing-library. - deprecated
Document (and deprecate) the previously undocumented
errorsproperty on theuseQueryQueryResulttype.
Release note
Potentially Breaking Fixes
- breaking
Changes usages of the
GraphQLErrortype toGraphQLFormattedError.This was a type bug - these errors were never
GraphQLErrorinstances
to begin with, and theGraphQLErrorclass has additional properties that can
never be correctly rehydrated from a GraphQL result.
The correct type to use here isGraphQLFormattedError.Similarly, please ensure to use the type
FormattedExecutionResult
instead ofExecutionResult- the non-"Formatted" versions of these types
are for use on the server only, but don't get transported over the network. - breaking
Call
nextFetchPolicywith "variables-changed" even if there is afetchPolicyspecified.Previously this would only be called when the current
fetchPolicywas equal to thefetchPolicyoption or the option was not specified. If you usenextFetchPolicyas a function, expect to see this function called more often.Due to this bug, this also meant that the
fetchPolicymight be reset to the initialfetchPolicy, even when you specified anextFetchPolicyfunction. If you previously relied on this behavior, you will need to update yournextFetchPolicycallback function to implement this resetting behavior.As an example, if your code looked like the following:
useQuery(QUERY, { nextFetchPolicy(currentFetchPolicy, info) { // your logic here } );Update your function to the following to reimplement the resetting behavior:
useQuery(QUERY, { nextFetchPolicy(currentFetchPolicy, info) { if (info.reason === 'variables-changed') { return info.initialFetchPolicy; } // your logic here } );
Minor Changes
Add support for
subscribeToMorefunction touseQueryRefHandlers.Support extensions in useSubscription
Add support for
subscribeToMorefunction touseLoadableQuery.Reimplement
useSubscriptionto fix rules of React violations.Rewrite big parts of
useQueryanduseLazyQueryto be more compliant with the Rules of React and React CompilerAdd the ability to specify a name for the client instance for use with Apollo Client Devtools. This is useful when instantiating multiple clients to identify the client instance more easily. This deprecates the
connectToDevtoolsoption in favor of a newdevtoolsconfiguration.new ApolloClient({ devtools: { enabled: true, name: "Test Client", }, });This option is backwards-compatible with
connectToDevtoolsand will be used in the absense of adevtoolsoption.Add support for
subscribeToMorefunction touseBackgroundQuery.- deprecated
Deprecates experimental schema testing utilities introduced in 3.10 in favor of recommending
@apollo/graphql-testing-library.
Patch Changes
Add React 19 RC to
peerDependenciesAdd
restartfunction touseSubscription.- removed
Remove deprecated
watchFragmentoption,canonizeResults createSchemaFetch: simulate serialized errors instead of anApolloErrorinstanceAdd
causefield toApolloError.MockLink: Add query default variables if not specified in mock request
watchFragment: forward additional options todiffOptionsFix issue where mutations were not accessible by Apollo Client Devtools in 3.11.0-rc.0.
Allow
IgnoreModifierto be returned from aoptimisticResponsefunction when inferring from aTypedDocumentNodewhen used with a generic argument.- deprecated
Document (and deprecate) the previously undocumented
errorsproperty on theuseQueryQueryResulttype. Allow wrapping
createQueryPreloaderAdd
ignoreResultsoption touseSubscription