Change8

@apollo/client@4.0.4

Breaking Changes
📦 apollo-client
1 breaking1 features🐛 2 fixes🔧 6 symbols

Summary

This patch release adds a type‑safe `skipToken` for query skipping, fixes unhandled promise rejections and invariant handling, and switches to a named `equal` export from `@wry/equality`, which requires import updates.

⚠️ Breaking Changes

  • The default export from "@wry/equality" was removed. Code that imported the equality function as a default import must be updated to use the named export `equal`.

Migration Steps

  1. Replace any default import of the equality helper from "@wry/equality" with a named import: `import { equal } from "@wry/equality";`.
  2. When skipping a query, replace `skip: true` with the `skipToken` value imported from "@apollo/client/react".
  3. Ensure that code handling the promise returned by `mutate` includes proper rejection handling or relies on the library's built‑in handling.

✨ New Features

  • Added support for `skipToken` with `useQuery` to provide a type‑safe way to skip query execution instead of using `skip: true`.

🐛 Bug Fixes

  • Prevent unhandled promise rejections from the promise returned by the `mutate` function of the `useMutation` hook.
  • Fixed an issue where calling `invariant` from external libraries would throw when no dev error message handler was loaded.

🔧 Affected Symbols

useMutationmutateuseQueryskipTokenequal@wry/equality