Change8

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

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

Released: 6/27/2025

2
Breaking Changes
4
Migration Steps
5
Affected Symbols

⚠️ Check Your Code

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

SetContextLinkSetContextLink.SetContextOperationDataValuesubscribeToMoreoperationType

Breaking Changes

Issue #1

The `SetContextLink` callback signature was changed: the parameters are now `(prevContext, operation)` instead of `(operation, prevContext)`. Update all callbacks to use the new order.

Issue #2

The `operation` argument type for `SetContextLink` callbacks changed from `GraphQLRequest` to `SetContextLink.SetContextOperation`, which no longer provides `getContext` or `setContext`. Remove any usage of those methods and rely on the `prevContext` argument; the new `operation` includes a `client` property.

Migration Steps

  1. 1
    Change all `new SetContextLink` callback definitions to accept `(prevContext, operation)` instead of `(operation, prevContext)`.
  2. 2
    Replace any usage of `operation.getContext()` or `operation.setContext()` inside SetContextLink callbacks with the `prevContext` argument, as the `operation` argument no longer includes those methods.
  3. 3
    If you rely on the `operation` argument's type, import `SetContextLink.SetContextOperation` and adjust type annotations accordingly.
  4. 4
    Optionally, import and extend the `DataValue` namespace via module augmentation to customize `Complete`, `Streaming`, or `Partial` types.

Release Summary

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

Need More Details?

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

View Full Changelog