Change8

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

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

Released: 8/5/2025

6
Breaking Changes
7
Migration Steps
13
Affected Symbols

⚠️ Check Your Code

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

serializeFetchParameterClientParseErrorOperationBatcherRetryLinkdelayattemptsHttpLinkBatchHttpLinkHttpLink.Options.fetchOptionscredentialssha256PersistedQueryLinkWebSocketLink

Breaking Changes

Issue #1

The `serializeFetchParameter` helper is no longer exported; callers must replace it with `stringify` directly.

Issue #2

`ClientParseError` type has been removed; JSON serialization errors are now thrown as generic errors.

Issue #3

`OperationBatcher` class is no longer exported from `@apollo/client/link/batch`; code that imported it will break.

Issue #4

`HttpLink.Options.fetchOptions` and the `fetchOptions` option for `BatchHttpLink` now require a `RequestInit` object instead of `any`, causing type errors for previous usages.

Issue #5

`credentials` option on `HttpLink`/`BatchHttpLink` now expects a `RequestCredentials` type instead of a plain string.

Issue #6

The `error` argument for `delay` and `attempts` functions on `RetryLink` must now be an `ErrorLike` object, breaking code that passed other types.

Migration Steps

  1. 1
    Replace any import of `serializeFetchParameter` with direct calls to `stringify`.
  2. 2
    Remove imports of `ClientParseError`; handle JSON serialization errors using generic `Error` handling.
  3. 3
    Stop importing `OperationBatcher` from `@apollo/client/link/batch`; rely on `BatchLink` internal implementation.
  4. 4
    Update code that passes `fetchOptions` to `HttpLink` or `BatchHttpLink` to provide a `RequestInit` object.
  5. 5
    Change any string literals used for the `credentials` option to the appropriate `RequestCredentials` enum values (`'omit'`, `'same-origin'`, `'include'`).
  6. 6
    Ensure that the `error` argument passed to `delay` and `attempts` on `RetryLink` conforms to the `ErrorLike` interface.
  7. 7
    Pass a string to the `sha256` function of `PersistedQueryLink` instead of an array or other types.

Release Summary

This release removes exported helpers, tightens type definitions, moves link types into a namespace, and updates RetryLink behavior, introducing breaking changes that require code adjustments.

Need More Details?

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

View Full Changelog