@apollo/client@4.0.0-alpha.21
Breaking Changes📦 apollo-client
⚠ 3 breaking✨ 2 features🔧 3 symbols
Summary
Added streaming support for `@defer` queries with a new `NetworkStatus.streaming` value and changed loading semantics, removed the `context` option from `useLazyQuery`, and made `cache.fragmentMatches` mandatory.
⚠️ Breaking Changes
- The `loading` flag now stays true for `@defer` queries until the streamed response completes, which may affect UI logic that expected `loading` to become false while streaming.
- `cache.fragmentMatches` is now required; the previous check and warning were removed, so data masking will crash if `cache.fragmentMatches` is missing.
- `useLazyQuery` no longer accepts a `context` option; `context` must be passed to the returned `execute` function, and omitted context defaults to an empty object.
Migration Steps
- Update UI or logic that checks the `loading` flag for `@defer` queries to handle the flag remaining true until streaming completes.
- Ensure your cache implementation provides a `fragmentMatches` function; otherwise data masking will throw.
- Remove `context` from `useLazyQuery` hook options and pass it as the first argument to the `execute` function instead; if omitted, it will default to `{}`.
✨ New Features
- Introduced `NetworkStatus.streaming` enum value, set as `networkStatus` while a `@defer` response is streaming.
- `@defer` queries are now considered loading until the full response is received.
🔧 Affected Symbols
NetworkStatususeLazyQuerycache.fragmentMatches