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
View all versions →@apollo/client@4.3.0-rc.2The `skip` option in `useQuery` and `useSubscription` has been deprecated in favor of `skipToken`.
@apollo/client-graphql-codegen@2.2.0-rc.11 featureThe `@apollo/client-graphql-codegen/custom-scalars` plugin has been updated to emit GraphQL list syntax for input objects and scalar type policies, improving schema representation.
@apollo/client@4.3.0-rc.1Breaking1 fix1 featureIntroduced support for scalars that are arrays, allowing for more precise type handling in field policies and input objects. Also fixed an issue with the `variables` property in mutation update functions.
@apollo/client-graphql-codegen@2.2.0-rc.0This release is a version bump only to the release candidate (rc) version.
@apollo/client@4.3.0-rc.0This release is a version bump only to the release candidate (rc) version.
@apollo/client@4.3.0-alpha.111 featureIntroduced `skipToken` for `useSubscription` to enhance type safety when skipping subscriptions with required variables. Also, removed the custom `NoInfer` type utility in favor of the native TypeScript 5.4 version.
@apollo/client@4.3.0-alpha.10Breaking1 featureUpdated the minimum supported TypeScript version to 5.9.x and introduced the ability to override the `from` input for fragment APIs with stricter policies.
@apollo/client@4.3.0-alpha.91 featureIntroduced `GraphQLCodegenIncremental` type overrides to better handle `@defer` operations with a "complete" `dataState`. This enhancement improves type safety for incremental data loading scenarios.
@apollo/client@4.3.0-alpha.81 fixThis release includes a fix for parsing scalar fields in `no-cache` queries, addressing an issue identified in pull request #13372.
@apollo/client@4.2.121 fixThis patch release addresses an issue with preserving multi-byte UTF-8 characters in multipart responses. It ensures that characters split across chunks are handled correctly.
@apollo/client@4.3.0-alpha.71 fix1 featureApollo Client now warns about and fixes cache feuds between queries, ensuring data consistency and preventing unnecessary refetches. It also improves the handling of non-normalized data in cache feuds.
@apollo/client@4.3.0-alpha.61 fixField policy read and merge functions are now ignored when the scalar option is configured, with a development-only warning emitted if both are present. A bug fix ensures dataState reports "streaming" correctly for missing @defer fields.
@apollo/client@4.3.0-alpha.58 fixesThis release addresses several issues related to `@defer` fragments and `@stream` fields, improving predictability and data handling for partial results and network errors. A `label` argument is now added to `@defer` directives for disambiguation.
@apollo/client@4.2.112 fixesThis patch release includes fixes for type signatures in documentation and adds a development warning for cache inconsistencies.
@apollo/client@4.2.104 fixesThis patch release addresses several type-related bugs in Apollo Client, improving the accuracy of return types for mutations, queries with constant variable types, and options passed to various API functions. It also refines the return types for `refetch`, `fetchMore`, and `useLazyQuery` based on the provided `errorPolicy`.
@apollo/client@4.2.92 fixesThis patch release addresses two bugs in Apollo Client. It fixes an issue with GraphQL variable default values not being applied correctly and resolves a problem with `@export` queries not reacting to cache updates.
@apollo/client@4.3.0-alpha.44 fixesThis patch release addresses issues with incremental queries and cache data leakage. It improves performance by optimizing error object construction and JSON stringification for cache diffs.
@apollo/client@4.2.81 fixThis patch release improves the behavior of the connectToDevtools function by preventing unnecessary setTimeout calls in non-browser environments. This change enhances test stability and avoids potential issues in test setups.
@apollo/client@4.3.0-alpha.34 fixesThis release improves the accuracy of `dataState` in complex incremental streaming scenarios with `@defer` and `@stream` directives, ensuring `read` functions are applied to intermediate results and fixing truncation issues with `@stream` queries when `returnPartialData: true`.
@apollo/client@4.2.7This patch release includes cleanup of some unused internals. Users are encouraged to report any unexpected changes.
@apollo/client-graphql-codegen@2.2.0-alpha.02 featuresIntroduced a new GraphQL Codegen plugin to generate configurations for custom scalars, simplifying their integration with Apollo Client's InMemoryCache and type policies.
@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.
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