Change8

v3.14.0-alpha.0

Breaking Changes
📦 apollo-client
1 breaking1 features🐛 1 fixes5 deprecations🔧 10 symbols

Summary

Apollo Client 4.0 introduces the new `preloadQuery.toPromise` API and removes the old `queryRef.toPromise`, while adding numerous deprecation warnings across React APIs, ApolloClient options, and cache settings. A bug fix prevents field policies from incorrectly merging into supertype policies.

⚠️ Breaking Changes

  • `queryRef.toPromise()` has been removed in Apollo Client 4.0. Use `preloadQuery.toPromise(queryRef)` instead. Update code to call the new method.

Migration Steps

  1. Replace all calls to `queryRef.toPromise()` with `preloadQuery.toPromise(queryRef)`.
  2. Review console warnings for deprecated React API options/methods and update to supported alternatives.
  3. Check for usage of deprecated ApolloClient options/methods and migrate to the recommended APIs.
  4. If using `addTypename` in InMemoryCache or MockedProvider, remove or replace it.
  5. If using `canonizeResults`, stop using it as it is deprecated.

✨ New Features

  • New `preloadQuery.toPromise(queryRef)` API replaces the removed `queryRef.toPromise()` method.

🐛 Bug Fixes

  • Field policies no longer overwrite or merge into supertype field policies, fixing unexpected merging behavior.

🔧 Affected Symbols

queryRef.toPromisepreloadQuery.toPromiseApolloClientInMemoryCacheMockedProvideraddTypenamecanonizeResultscache.gcaddTypenameTransformfragments

⚡ Deprecations

  • Options and methods for all React APIs are now deprecated; warnings will be emitted.
  • `queryRef.toPromise()` is deprecated and removed; use `preloadQuery.toPromise`.
  • Various ApolloClient options and methods are deprecated; warnings will be emitted.
  • `addTypename` option in InMemoryCache and MockedProvider is deprecated.
  • `canonizeResults` is deprecated.