Change8

@apollo/client@4.3.0-alpha.4

📦 apollo-clientView on GitHub →
🐛 4 fixes🔧 3 symbols

Summary

This patch release addresses issues with incremental queries and cache data leakage. It improves performance by optimizing error object construction and JSON stringification for cache diffs.

🐛 Bug Fixes

  • Fixed an issue where `network-only` incremental queries could cause cache data to leak into the emitted result when a `@defer` or `@stream` boundary already had complete data in the cache. Cache data inside pending `@defer` objects and `@stream` arrays are now pruned so that only completed `@defer` or `@stream` boundaries are returned. This change only applies to `InMemoryCache` when using `GraphQL17Alpha9Handler`.
  • Cache diffs for incomplete queries no longer pay the cost of building a full `MissingFieldError` when the `missing` property is not accessed. The error object is now only constructed when the `missing` property is accessed the first time, improving performance by avoiding a V8 stack capture when `missing` is ignored.
  • As an additional small performance improvement, `stringify` is no longer used in the error message on objects whose cache ID is known. `stringify` is only used for non-normalized objects.
  • Fixed an issue where partial cache data could leak into intermediate incremental results, potentially causing runtime crashes if you relied on the presence of values to determine whether the `@defer` data had streamed in or not.

Affected Symbols