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.3.0-alpha.3@apollo/client@4.2.7@apollo/client-graphql-codegen@2.2.0-alpha.0@apollo/client@4.2.62 fixesThis patch release addresses an issue with relay multipart subscriptions failing serialization and optimizes cache writes by refining how @stream directives are detected during field updates.
@apollo/client-graphql-codegen@2.1.11 fixThis patch release fixes an issue where runtime files were accidentally omitted in the previous minor release.
@apollo/client-graphql-codegen@2.1.01 featureThis minor release updates peer dependency support to include the latest major versions of the GraphQL Codegen package.
@apollo/client@4.2.51 featureThis patch release focuses on exporting two previously internal types, KeyArgsFunction and RelayFieldPolicy, to public entrypoints for broader use.
@apollo/client@4.3.0-alpha.27 featuresThis release introduces comprehensive support for custom scalars within Apollo Client, allowing users to define parsing and serialization logic for non-standard scalar types in both cache operations and network requests.
@apollo/client@4.2.41 fixThis patch release fixes a bug where the `optimistic` option was ignored by `client.readFragment` and `client.readQuery`.
@apollo/client@4.3.0-alpha.11 fixThis patch release aligns the generic constraints on several deprecated and internal types to match the standard Cache.Implementation, improving consistency across the cache API.
@apollo/client@4.3.0-alpha.01 featureThis release introduces TypeScript support for correctly typing the cache instance when using custom cache implementations with Apollo Client.
@apollo/client@4.2.3This patch release adds support for graphql v17 as a valid peer dependency.
@apollo/client@4.2.21 fixThis patch release focuses on improving data handling during refetches by preserving referential equality for masked data when results are deeply equal.
@apollo/client@4.2.11 fixThis patch release fixes a bug in useLazyQuery related to applying pollInterval changes between renders.
@apollo/client@4.2.010 featuresApollo Client 4.2 introduces optional "classic" and "modern" method/hook signatures to improve type accuracy based on default options. This release also adds comprehensive support for automatic event-based query refetching via the new RefetchEventManager.
@apollo/client@4.2.0-rc.0This minor release primarily involves a version bump to the release candidate (rc) version.
@apollo/client@4.2.0-alpha.81 fix1 featureThis patch fixes an issue with `refetchOn` merging logic when default and per-query options conflict, and introduces customization for the default event handler in `RefetchEventManager`.
@apollo/client@4.2.0-alpha.71 featureThis release enhances type safety for default options when using `preloadQuery` by extending the existing work from `defaultOptions` to the preloading mechanism.
@apollo/client@4.2.0-alpha.61 fixThis patch release addresses an issue where the deprecation warning for classic function signatures was incorrectly applied when using type inference with TypedDocumentNode.
@apollo/client@4.2.0-alpha.51 fixThis patch release improves developer experience by ensuring proper IntelliSense suggestions for the options object in several core query hooks.
@apollo/client@4.2.0-alpha.48 featuresThis release introduces automatic event-based refetching capabilities through the new RefetchEventManager, allowing queries to automatically refresh on events like window focus or network reconnection. Event refetching is opt-in and highly configurable at both the client and query levels.
@apollo/client@4.2.0-alpha.34 featuresThis release enhances type safety for mutations by propagating the `errorPolicy` setting from `defaultOptions` and individual calls into the return types of `client.mutate` and `useMutation`.
@apollo/client@4.1.91 fixThis patch release addresses a build artifact issue by removing the unnecessary "workspaces" field from the published package.json to silence Yarn v1 warnings.
@apollo/client@4.1.81 featureThis patch release introduces a new agent skill for integration with @tanstack/intent, bundled within the npm package.
@apollo/client@4.2.0-alpha.2Breaking1 fix3 featuresApollo Client 4.2 introduces 'classic' and 'modern' signature styles, enhancing type safety by synchronizing hook/method return types with declared default options. This requires explicit type declaration for used default options to maintain type accuracy.
@apollo/client@4.1.71 fixThis patch release addresses an interop issue related to RxJS when using WebSocketLink.
v3.14.12 fixesThis patch release fixes issues related to deprecation warning silencing across entrypoints and within React hooks, and deprecates the `variableMatcher` option in `MockLink`.
@apollo/client@4.2.0-alpha.1This patch release includes changes from versions 4.1.5 and 4.1.6.
@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.
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