Change8

Migrating to Apollo Client @apollo/client@4.0.0-rc.6

Version @apollo/client@4.0.0-rc.6 introduces 6 breaking changes. This guide details how to update your code.

Released: 7/28/2025

6
Breaking Changes
6
Migration Steps
8
Affected Symbols

⚠️ Check Your Code

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

DataProxyTVariablesuseMutationCache.ReadOptionsApolloConsumerApolloClientObservableQueryApolloCache.watchFragment

Breaking Changes

Issue #1

Removed the `DataProxy` namespace and interface; imports referencing `DataProxy` must be removed or replaced with the new location.

Issue #2

`TVariables` now always extends `OperationVariables` in all interfaces; code that defined `TVariables` without this constraint must be updated.

Issue #3

The `mutation` option is no longer allowed for the `mutate` function returned from `useMutation`; callers must remove this option.

Issue #4

The generic type parameters for `Cache.ReadOptions` were reordered from `<TVariables, TData>` to `<TData, TVariables>`; update all usages accordingly.

Issue #5

`ApolloConsumer` component has been removed; replace it with the `useApolloClient` hook.

Issue #6

Method options and result types for `ApolloClient`, `ObservableQuery`, and `ApolloCache.watchFragment` have been moved into dedicated namespaces; code importing the old types must be updated to the new namespace paths.

Migration Steps

  1. 1
    Remove all imports of `DataProxy` and update code to use the new APIs that replace its functionality.
  2. 2
    Ensure any custom `TVariables` types extend `OperationVariables` or adjust generic constraints accordingly.
  3. 3
    Delete the `mutation` field from options passed to the `mutate` function returned by `useMutation`.
  4. 4
    Update all `Cache.ReadOptions` usages to match the new generic order `<TData, TVariables>`.
  5. 5
    Replace any usage of the `ApolloConsumer` component with the `useApolloClient` hook.
  6. 6
    Import the moved types from their new namespaces (e.g., `ApolloClient.Options`, `ObservableQuery.Options`, `ApolloCache.WatchFragmentOptions`) and remove references to the deprecated exports.

Release Summary

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

Need More Details?

View the full release notes and all changes for Apollo Client @apollo/client@4.0.0-rc.6.

View Full Changelog