Apollo Client
Backend & InfraThe industry-leading GraphQL client for TypeScript, JavaScript, React, Vue, Angular, and more. Apollo Client delivers powerful caching, intuitive APIs, and comprehensive developer tools to accelerate your app development.
Release History
@apollo/client@4.1.61 fixThis patch release addresses a specific hydration mismatch issue occurring in `useQuery` when server-side rendering is disabled alongside query skipping.
@apollo/client@4.1.52 fixesThis patch release addresses two specific bugs: one concerning unnecessary polling in useQuery when skipped, and another regarding incorrect option application in client.query.
@apollo/client@4.2.0-alpha.01 fix1 featureThis minor release improves the TypeScript return type accuracy for `client.query` based on the configured `errorPolicy`, specifically making the `data` property non-nullable when `errorPolicy` is set to 'none'.
@apollo/client@4.1.41 fixThis patch release ensures that PersistedQueryLink correctly merges context values for http and fetchOptions.
@apollo/client@4.1.31 fixThis patch introduces support for cancellation via `AbortController` in subscriptions created by `createFetchMultipartSubscription`.
@apollo/client@4.1.23 fixesThis patch release addresses several issues related to Server-Side Rendering (SSR) behavior, specifically ensuring correct handling of fetch policies and skip tokens during initial data reading.
@apollo/client@4.1.11 fixThis patch release fixes an issue related to the resolution of @client fields nested under aliased server fields.
@apollo/client@4.1.04 fixes9 featuresThis release introduces significant enhancements to cache interaction, including support for array watching via fragments, new options for context in `useMutation`, and expanded support for GraphQL incremental delivery specifications like `@defer` (v17 alpha 9) and `@stream`.
@apollo/client@4.0.131 fixThis patch release ensures that internal utilities `compact` and `mergeOptions` correctly preserve symbol keys, resolving an issue with `defaultOptions` in `watchQuery`.
@apollo/client@4.0.121 fixThis patch release addresses a potential memory leak issue related to Trie nodes remaining in memory too long.
@apollo/client@4.1.0-rc.1@apollo/client@4.1.0-rc.0Breaking1 fix2 featuresAdded stream‑info handling improvements, exposed a new type for cache extensions, and fixed redundant merge calls, with a breaking change affecting the legacy `Defer20220824Handler`.
@apollo/client@4.0.12-beta.01 fix1 featureThis patch release adds automatic cleanup of PreloadedQueryRef instances and changes @stream array truncation to occur only on the final chunk.
@apollo/client@4.1.0-alpha.91 fix2 featuresThis release adds new cache behavior for undefined array items, introduces an \`extensions\` option to cache write methods, and improves fragment hooks with memoized observable mapping.
@apollo/client@4.0.112 fixes1 featurePatch release fixing refetch behavior for standby queries and replacing `findLast` with compatible methods, plus a hidden option for framework integrations.
@apollo/client@4.0.101 fixPatch release addressing a memory leak in Apollo Client.
@apollo/client@4.1.0-alpha.81 featureAdded support for a `headers` transport, improving client awareness.
@apollo/client@4.1.0-alpha.71 featureIntroduces a new `from` option for readFragment, watchFragment, and updateFragment.
@apollo/client@4.1.0-alpha.61 featurePerformance improvement: `watchFragment` now reuses existing observables, reducing overhead during repeated cache watches.
@apollo/client@4.1.0-alpha.53 fixesPatch release fixing incremental chunk error handling in `ErrorLink` and improving `@stream` processing with `Defer20220824Handler` to prevent runtime errors.
@apollo/client-graphql-codegen@2.0.0BreakingThe release upgrades all upstream dependencies to their next major versions, potentially introducing breaking changes.
@apollo/client@4.1.0-alpha.42 featuresThis patch adds flexibility to FragmentType generics and introduces a new QueryRef.ForQuery helper type.
@apollo/client@4.1.0-alpha.21 fix1 featureThis release adds a callback‑based `context` option for `useMutation` and introduces a validation error for `@stream` without an `incrementalDelivery` handler.
@apollo/client@4.1.0-alpha.34 fixes4 featuresThis release adds null and array support to fragment watching APIs, introduces a `getCurrentResult` helper, deduplicates duplicate watches for better performance, and includes several bug fixes and incremental delivery updates.
@apollo/client@4.1.0-alpha.12 fixes3 featuresThis release introduces an abstract `resolvesClientField` API, adds experimental feature support, and refines `@client` field handling, including warnings for `no-cache` queries.
@apollo/client@4.1.0-alpha.03 fixes2 featuresThis release adds support for the newer incremental delivery format for `@defer` and introduces `@stream` handling across handlers, while fixing several bugs related to deferred payloads and fetchMore rendering.
@apollo/client@4.0.91 fixPatch release fixes a regression in `useSuspenseQuery` and `useBackgroundQuery` where changing to `skipToken` unintentionally created a new ObservableQuery and caused refetches without variables.
@apollo/client@4.0.81 fixPatch release fixing cache.modify() handling of readonly arrays.
@apollo/client@4.0.7Breaking1 fixPatch release removes the `operationType` field from `GraphQLWsLink` payloads, fixing related bugs but may require server adjustments.
@apollo/client@4.0.61 fixPatch release fixing fetchMore loading state reset issue.
@apollo/client@4.0.51 fixPatch release that fixes an invariance type error in the MockedResponse type.
@apollo/client@4.0.4Breaking2 fixes1 featureThis patch release adds a type‑safe `skipToken` for query skipping, fixes unhandled promise rejections and invariant handling, and switches to a named `equal` export from `@wry/equality`, which requires import updates.
@apollo/client@4.0.31 fix1 featurePatch release that fixes a deep re-export issue in the React internals and enhances IntelliSense for `useMutation` variables.
@apollo/client@4.0.21 fixThe patch restores access to `getMemoryInternals` in development builds.
@apollo/client-codemod-migrate-3-to-4@1.0.21 fixPatch release fixing the misplaced `networkStatus` implementation.
@apollo/client@4.0.11 fix2 featuresThis patch fixes the CJS build for `invariantErrorCodes` and introduces the new utility `isNetworkStatusInFlight` while adding the deprecated `isNetworkStatusSettled` to Apollo Client utilities.
@apollo/client-codemod-migrate-3-to-4@1.0.12 featuresThis patch adds and re-exports network status utilities, introducing `isNetworkStatusInFlight` and deprecating `isNetworkStatusSettled`.
@apollo/client-graphql-codegen@1.0.01 featureThis release adds a new GraphQL Codegen plugin for generating LocalState resolver types and bumps the codegen package version to a release candidate.
@apollo/client@4.0.0Breaking9 featuresApollo Client 4.0 introduces a framework‑agnostic core, unified error handling, opt‑in local state, a new `dataState` property, and class‑based links, while removing `ApolloError` and several legacy APIs, requiring code migrations.
@apollo/client-codemod-migrate-3-to-4@1.0.0Breaking5 featuresApollo Client 4.x introduces extensive migration tooling, renames import entry points, and overhauls client setup options, requiring developers to run codemods and adjust configuration.
v3.14.0Breaking1 fix1 featureThis minor release adds extensive deprecation warnings for APIs removed in Apollo Client 4.0 and introduces `preloadQuery.toPromise` as the new way to await preloaded queries, along with a fix for field‑policy merging.
@apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3Breaking2 featuresApollo Client introduces a `clientSetup` codemod to restructure client configuration and a `legacyEntryPoints` transformation to update import paths, requiring updates to option names, removed settings, and import statements.
@apollo/client@4.0.0-rc.131 featureIntroduces a versioning policy for Apollo Client.
@apollo/client@4.0.0-rc.12Breaking1 featureIntroduced a @apollo/client/v4-migration entrypoint that surfaces removed values and types with migration guidance, addressing breaking changes from their removal.
@apollo/client-codemod-migrate-3-to-4@1.0.0-rc.21 featureThis minor release extends the `imports` codemod and adds new `links` and `removals` codemods.
@apollo/client@4.0.0-rc.11BreakingThis release introduces a breaking change requiring explicit type augmentation for incremental delivery handlers and removes the `DataMasking` interface, necessitating code updates.
@apollo/client@4.0.0-rc.10Breaking1 featureThis release makes data‑masking types opt‑in only, removes the `mode` option and the `Masked`/`MaskedDocumentNode` types, and requires migration steps to adjust type declarations.
@apollo/client@4.0.0-rc.91 fix2 featuresThis release adds production logging for invariant.error, extends HttpLink and BatchHttpLink context options with client awareness settings, and fixes AbortSignal handling.
@apollo/client@4.0.0-rc.8Breaking2 fixes7 featuresThis release removes exported helpers, tightens type definitions, moves link types into a namespace, and updates RetryLink behavior, introducing breaking changes that require code adjustments.
@apollo/client@4.0.0-rc.7Breaking1 fix5 featuresThis release introduces several breaking TypeScript API changes—including read-only operation contexts, removal of certain request fields, and stricter link handler requirements—while adding features like multi-link concatenation and improved type safety.
v3.13.91 fixPatch release fixing a race condition when queries are reobserved before their initial subscription.
@apollo/client@4.0.0-rc.6BreakingThe update removes the `DataProxy` namespace, flips generic type orders, disallows the `mutation` option in `useMutation`, deprecates old type exports, and removes `ApolloConsumer`, requiring code adjustments.
@apollo/client@4.0.0-rc.5Breaking3 featuresThis release adds improved handling of masked fragments, introduces dataState in watchFragment, normalizes empty argument storage, and updates cache read behavior, while deprecating old readFragment/readQuery signatures and removing gql from the react entrypoint.
@apollo/client-codemod-migrate-3-to-4@1.0.0-rc.1BreakingThe `gql` export was removed from `@apollo/client/react`; import it from `@apollo/client` instead.
@apollo/client@4.0.0-rc.42 featuresIntroduces `dataState` and customizable `DataValue` types for `useFragment` and `useSuspenseFragment`.
v3.14.0-rc.0Minor release that bumps the version to the latest release candidate.
@apollo/client@4.0.0-rc.31 featureApollo Client now ships a React-Compiler compiled version of its React hooks via a new @apollo/client/react/compiled entry point, and the client.reFetchObservableQueries method has been renamed to client.refetchObservableQueries (deprecated alias retained).
v3.14.0-alpha.11 featureThis minor release adds @deprecated tags to removed query‑related properties and introduces a warning when `standby` fetch policy is used with `client.query`.
v3.14.0-alpha.0Breaking1 fix1 featureApollo Client 4.0 introduces the new `preloadQuery.toPromise` API and removes the old `queryRef.toPromise`, while adding numerous deprecation warnings across React APIs, ApolloClient options, and cache settings. A bug fix prevents field policies from incorrectly merging into supertype policies.
@apollo/client-codemod-migrate-3-to-4@1.0.0-rc.0Breaking1 featureApollo Client 4.x introduces a migration codemod to update old 3.x import paths to the new 4.x entrypoints.
@apollo/client@4.0.0-rc.2Breaking2 fixes1 featureThis release introduces a breaking change to `SetContextLink` callback parameters and operation type, adds overridable `DataValue` types for response states, and includes bug fixes for `operationType` propagation and `subscribeToMore` error typing.
@apollo/client@4.0.0-rc.1Breaking3 fixes5 featuresThis release removes two deprecated configuration options, adds a new `operationType` field for easier operation checks, exports several types, and includes bug fixes around resolver warnings and query rerendering.
@apollo/client-graphql-codegen@1.0.0-rc.0Version bump for codegen to release as a release candidate (rc).
@apollo/client@4.0.0-rc.0This release only bumps the version to publish the latest code as a release candidate.
@apollo/client@4.0.0-alpha.23Breaking2 fixes6 featuresThis release introduces significant improvements to `cache-only` query behavior, making them more predictable by preventing unnecessary fetches and initial loading states. It also modernizes link creation by favoring classes over creator functions and refines option inheritance in `fetchMore`.
@apollo/client@4.0.0-alpha.22Breaking1 fix4 featuresThis release introduces enhanced client awareness, changes default behaviors for extensions and multipart Accept headers, adds new link utilities, and enforces stricter alias rules, along with a bug fix for persisted queries.
@apollo/client@4.0.0-alpha.21Breaking2 featuresAdded streaming support for `@defer` queries with a new `NetworkStatus.streaming` value and changed loading semantics, removed the `context` option from `useLazyQuery`, and made `cache.fragmentMatches` mandatory.
@apollo/client@4.0.0-alpha.20Breaking4 featuresApollo Client 8 introduces breaking API changes: ObservableQuery loses its queryId, getObservableQueries now returns a Set, and preloadQuery’s toPromise API changes, while adding a new ObservableQuery.stop method and more aggressive client cleanup.
@apollo/client@4.0.0-alpha.19Breaking3 featuresAdds subscription restart capability and full‑lifecycle deduplication, while changing early‑unsubscribe behavior for ObservableQuery.
@apollo/client@4.0.0-alpha.181 featureIntroduces an optional override mechanism for Apollo Client’s DataMasking types, allowing custom implementations while preserving default behavior.
@apollo/client@4.0.0-alpha.17Breaking3 featuresThis release introduces a new `dataState` property and modifies the `TData` generic handling, removes the deprecated `QueryReference` type, and adds a `.retain()` method to result promises, requiring migration of type signatures and handling of lazy query execution.
@apollo/client@4.0.0-alpha.16Breaking3 featuresThis release aligns Apollo Client with the GraphQL over HTTP spec by adding `application/graphql-response+json` support, changing error handling, and updating the default `Accept` header, while introducing breaking changes to `ServerError` and link notifications.
@apollo/client-graphql-codegen@1.0.0-alpha.01 featureA new GraphQL Codegen plugin '@apollo/client-graphql-codegen/local-state' adds generated resolver types for LocalState, enabling type‑safe local resolvers.
v4.0.0-alpha.15Breaking2 fixes2 featuresThis release moves unstable testing utilities to an internal namespace, removes several deprecated testing helpers, adds subtle `useQuery` and `ObservableQuery` behavior improvements, and deprecates old MockLink type exports.
v4.0.0-alpha.14Breaking9 featuresApollo Client introduces a new `LocalState` system, removes several legacy APIs, and changes resolver context handling, requiring migration steps for existing applications.
v4.0.0-alpha.13BreakingApollo Client introduces a restructuring of utility modules and removal of experimental testing utilities, requiring import path updates and migration to the GraphQL Testing Library.
v4.0.0-alpha.12BreakingApollo Client 4.x introduces breaking changes: removal of `typeDefs`, `TContext`, and support for `graphql` v15, a mandatory `link` option, and a renamed link entrypoint, requiring migration steps for existing code.
v4.0.0-alpha.11Breaking1 fix5 featuresApollo Client vX introduces major API changes: context no longer provides `cache`/`forceFetch`, `ApolloLink.execute` now requires a client argument, and `useMutation` typings are stricter, alongside new features like custom context typing and a re‑exported `gql`.
v4.0.0-alpha.10Breaking2 fixes9 featuresThis release introduces stricter variable handling, new error utilities, and several breaking changes such as removal of `standby` fetchPolicy and deprecation of `never` as a TVariables type.
v3.13.81 fixPatch release fixing an issue where in‑flight multipart urql subscriptions could be incorrectly cancelled.
v4.0.0-alpha.9Breaking4 fixes2 featuresThis release introduces automatic loading state emission by default and adds initial loading support for ObservableQuery, while fixing several useLazyQuery and polling behaviors.
v4.0.0-alpha.8Breaking1 fix6 featuresThis release adds a unified error handling API for `onError`, enhances `MockLink` with variable callbacks, realistic delay helpers, and default delay configuration, while removing deprecated methods and options that require migration.
v3.13.7This patch refactors notification scheduling and cache emit logic by moving code from QueryInfo to ObservableQuery, with no functional changes.
v3.13.61 fixPatch release fixes ObservableQuery behavior in useQuery, keeping it inactive until the first subscription.
v4.0.0-alpha.7BreakingRemoved several React entry points and the parser cache, requiring import updates to `@apollo/client/react` and removal of parser usage.
v4.0.0-alpha.6Breaking3 featuresThis release introduces stricter error handling for empty link chains, removes obsolete loading‑state properties from promise‑based query APIs, adds partial data to combined GraphQL errors, and provides a new `prerenderStatic` SSR method while deprecating older SSR helpers.
v4.0.0-alpha.5Breaking2 fixes5 featuresThe update replaces `FetchResult` with new `SubscribeResult` and `MutateResult` types, removes deprecated subscription callbacks, unifies error handling, and includes several bug fixes and SSR improvements.
v4.0.0-alpha.4Breaking3 featuresApollo Client v4 introduces public `reobserve`, renames network fetch control to `prioritizeCacheValues`, removes several legacy hook types, and restructures React hook typings, requiring migration steps.
v4.0.0-alpha.3Breaking1 featureNetwork errors now respect `errorPolicy` and the `called` property was removed from `useQuery`, requiring updates to error handling and query state checks.
v3.13.51 fixPatch release resolves a cache-first query bug that caused stale data to be returned under certain variable and skip conditions.
v4.0.0-alpha.2Breaking1 fix3 featuresApollo Client 4.0 removes several generic arguments and options, defaults data and variable types to `unknown`/`OperationVariables`, and fixes the CommonJS build, requiring code updates for TypeScript users.
v4.0.0-alpha.1Breaking2 featuresApollo Client removes legacy streaming workarounds and several polyfills, adds a react-server entry point, and drops the rehackt dependency, resulting in a smaller bundle but requiring updated fetch implementations and React Native versions.
v4.0.0-alpha.0Breaking6 featuresApollo Client introduces major breaking changes by removing several legacy utilities, dropping React 16 support, and replacing the `ApolloError` wrapper with new error classes, while adding `CombinedGraphQLErrors`, `CombinedProtocolErrors`, and updated query behaviors.
v3.13.41 fixPatch release resolves import problems with external CJS modules by switching to a star import from `rehackt`.
v3.13.31 fixPatch release corrects networkStatus reporting for queries with errorPolicy "all", fixing observableQuery, useQuery, and useLazyQuery behavior.
v3.13.23 fixesPatch release fixing symbol duplication, DeepOmit typing, and MockLink debug output.
v3.13.1Breaking1 featurePatch release introduces a breaking change to ObservableQuery.refetch behavior and adds a new exported type UseSuspenseFragmentOptions.
v3.13.0Breaking5 fixes1 featureApollo Client 3.13.0 adds the `useSuspenseFragment` hook, improves TypeScript typings, and fixes several bugs, while deprecating several callbacks and options.
v3.13.0-rc.05 fixes3 featuresThis release introduces the useSuspenseFragment hook, improves type safety for updateQuery, adds multipart query deduplication, deprecates several callbacks and options, and includes several bug fixes and type corrections.
v3.12.112 fixesPatch release fixing observableQuery status handling for fetchMore with no-cache policy and adding the missing main.d.cts file.
Common Errors
ApolloError2 reportsApolloError usually indicates a GraphQL error returned from the server, such as validation errors or server-side exceptions. To fix, inspect the `error.graphQLErrors` array within the ApolloError instance to understand the specific server-reported issues, then adjust your query, mutation, or server-side resolvers accordingly to resolve the underlying problems. You can also use `error.networkError` for network-related issues if no GraphQL errors are present.
LocalStateError1 reportLocalStateError in Apollo Client often arises from attempting to use local resolvers for fields that are *also* returned by your GraphQL server. To resolve this, either remove the local resolver for the conflicting field and rely solely on the server's response, or rename the field on the client-side to avoid the collision. Ensure your schema definition aligns with whether the field is managed by the server, or locally.
ServerParseError1 reportThe ServerParseError in Apollo Client usually stems from the GraphQL server returning a response that is not valid JSON, often an HTML error page instead of the expected GraphQL data. To fix this, inspect the server's response in your browser's network tab for non-JSON content and address the underlying server-side error (e.g., a PHP error, incorrect endpoint, or server outage). Additionally, ensure your Apollo Client `uri` configuration points to the correct GraphQL endpoint.
ServerError1 reportServerError in apollo-client often arises when the server responds with a non-200 HTTP status code or an unexpected content type, particularly when the client expects `application/graphql-response+json`. To resolve this, ensure the server returns a 200 status code and correctly formats GraphQL responses as `application/json` or `application/graphql-response+json`, or implement custom error handling in your Apollo Client link chain to gracefully manage alternative error responses. The latter would involve creating custom `onError` link that checks status codes and formats the error accordingly.
TestingLibraryElementError1 reportTestingLibraryElementError in Apollo Client usually arises when tests run faster than asynchronous operations like queries complete, leading to components rendering before data is available. Ensure that you await asynchronous Apollo operations (e.g., `useLazyQuery`'s `execute` function) within your tests using `await act(async () => { ... })` or similar constructs to allow data fetching to finish before assertions. Additionally, avoid relying directly on `data` or `error` immediately after triggering a query, instead use `waitFor` or similar utilities to wait for specific UI updates based on the fetched data.
GraphQLFormattedError1 reportGraphQLFormattedError in Apollo Client usually indicates a problem on the GraphQL server or a mismatch between the client's expected data structure and the server's response. To fix it, carefully examine the error message's `extensions.exception` (if present) on the server logs to identify server-side issues and ensure the client-side query aligns precisely with the server's schema, including checking types and fields; also validate the server is returning the data in the expected format for the matching query.
Related Backend & Infra Packages
Production-Grade Container Scheduling and Management
Node.js JavaScript runtime ✨🐢🚀✨
Promise based HTTP client for the browser and node.js
A modern runtime for JavaScript and TypeScript.
Deliver web apps with confidence 🚀
Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
Subscribe to Updates
Get notified when new versions are released