Change8

v4.0.0-alpha.4

Breaking Changes
📦 apollo-client
4 breaking3 features2 deprecations🔧 13 symbols

Summary

Apollo Client v4 introduces public `reobserve`, renames network fetch control to `prioritizeCacheValues`, removes several legacy hook types, and restructures React hook typings, requiring migration steps.

⚠️ Breaking Changes

  • `ObservableQuery.setOptions` has been removed; callers must replace it with `ObservableQuery.reobserve` and cannot pass the `newNetworkStatus` argument.
  • `ApolloClient.disableNetworkFetches` has been renamed to `ApolloClient.prioritizeCacheValues`; code must use the new method name.
  • Removed base React hook types (`BaseMutationOptions`, `BaseQueryOptions`, `BaseSubscriptionOptions`, `ObservableQueryFields`, `MutationSharedOptions`, `QueryFunctionOptions`); update code to use the specific hook types.
  • `useQuery` no longer returns a `reobserve` function in its result; update components to rerender the hook with new options instead of calling `reobserve`.

Migration Steps

  1. Replace all calls to `observable.setOptions(...)` with `observable.reobserve(...)` and drop any `newNetworkStatus` argument.
  2. Rename `client.disableNetworkFetches` to `client.prioritizeCacheValues` and adjust any related logic.
  3. Update imports to use the new hook types and remove references to the deleted base types.
  4. If you were using `useQuery`'s `reobserve` result, refactor to rerender the hook with new options instead.
  5. Adjust TypeScript imports to reference `useQuery.Options` and `useQuery.Result` under the new namespace.

✨ New Features

  • `ObservableQuery.reobserve` is now a public API.
  • `ApolloClient.prioritizeCacheValues` provides refined control over cache prioritization during SSR.
  • React hook types have been flattened and namespaced under their hook name for clearer usage.

🔧 Affected Symbols

ObservableQuery.setOptionsObservableQuery.reobserveApolloClient.disableNetworkFetchesApolloClient.prioritizeCacheValuesuseQueryBaseMutationOptionsBaseQueryOptionsBaseSubscriptionOptionsObservableQueryFieldsMutationSharedOptionsQueryFunctionOptionsuseQuery.OptionsuseQuery.Result

⚡ Deprecations

  • Old React hook result and option types (e.g., `useQuery.Options`, `useQuery.Result` under previous naming) are deprecated and will be removed in v5; migrate to the new namespaced types.
  • The removed base hook types are deprecated prior to removal.