Change8

@apollo/client@4.1.0-alpha.0

📦 apollo-client
2 features🐛 3 fixes🔧 5 symbols

Summary

This release adds support for the newer incremental delivery format for `@defer` and introduces `@stream` handling across handlers, while fixing several bugs related to deferred payloads and fetchMore rendering.

Migration Steps

  1. Import and configure `GraphQL17Alpha9Handler` in the ApolloClient `incrementalHandler` option when the GraphQL server implements the newer incremental delivery format.
  2. Ensure the GraphQL server is upgraded to support the newer incremental delivery format (graphql@17.0.0-alpha.9 or later).
  3. If using Apollo Router, continue using `Defer20220824Handler` as it does not yet support the newer format.
  4. Update any custom logic that relied on the previous array merging behavior for deferred payloads, as the new handling may drop excess items.

✨ New Features

  • Added support for the newer incremental delivery format for the `@defer` directive via `GraphQL17Alpha9Handler`.
  • Added `@stream` directive support to both `Defer20220824Handler` and `GraphQL17Alpha2Handler`.

🐛 Bug Fixes

  • Fixed issue where deferred payloads returning arrays with fewer items retained stale items from the cached array, including for `@stream` arrays.
  • Fixed `fetchMore` with `@defer` or `@stream` not rerendering incremental results as they streamed.
  • Improved cache data loss warning message when `existing` or `incoming` is an array.

🔧 Affected Symbols

GraphQL17Alpha9HandlerDefer20220824HandlerGraphQL17Alpha2HandlerfetchMoreApolloClient