Change8

Migrating to Apollo Client @apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3

Version @apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3 introduces 6 breaking changes. This guide details how to update your code.

Released: 8/20/2025

6
Breaking Changes
8
Migration Steps
9
Affected Symbols

⚠️ Check Your Code

If you use any of these symbols, you need to read this guide:

HttpLinkLocalStateclientAwarenessdevtools.enabledprioritizeCacheValues@apollo/client/main.cjs@apollo/client/react/react.cjs@apollo/client@apollo/client/react

Breaking Changes

Issue #1

Options `uri`, `headers` and `credentials` are no longer top-level; they must be moved into a `link` option with a new `HttpLink` instance.

Issue #2

`name` and `version` options have been moved into a `clientAwareness` option.

Issue #3

`typeDefs` and `fragmentMatcher` options have been removed; use `localState` with a `LocalState` instance and move `resolvers` accordingly.

Issue #4

`connectToDevTools` option has been renamed to `devtools.enabled`.

Issue #5

`disableNetworkFetches` option has been renamed to `prioritizeCacheValues`.

Issue #6

Imports from legacy entry points such as `@apollo/client/main.cjs` or `@apollo/client/react/react.cjs` must be updated to the new entry points `@apollo/client` or `@apollo/client/react`.

Migration Steps

  1. 1
    Run the new `clientSetup` codemod (e.g., `npx apollo clientSetup`) to automatically apply the configuration changes.
  2. 2
    If not using the codemod, manually move `uri`, `headers`, and `credentials` into a `link` option with a new `HttpLink` instance.
  3. 3
    Move `name` and `version` into a `clientAwareness` option.
  4. 4
    Replace removed `typeDefs` and `fragmentMatcher` options with a `localState` option containing a `LocalState` instance and relocate `resolvers`.
  5. 5
    Rename `connectToDevTools` to `devtools.enabled` and `disableNetworkFetches` to `prioritizeCacheValues`.
  6. 6
    If `dataMasking` is enabled, add the provided global type augmentation template.
  7. 7
    If using custom links, add the `incrementalHandler` option and the corresponding type augmentation template.
  8. 8
    Run the `legacyEntryPoints` transformation (or update import statements) to replace legacy entry point paths with the new ones.

Release Summary

Apollo 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.

Need More Details?

View the full release notes and all changes for Apollo Client @apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3.

View Full Changelog