v4.0.0-alpha.6
Breaking Changes📦 apollo-client
⚠2 breaking✨ 3 features⚡ 1 deprecations🔧 14 symbols
Summary
This release introduces stricter error handling for empty link chains, removes obsolete loading‑state properties from promise‑based query APIs, adds partial data to combined GraphQL errors, and provides a new `prerenderStatic` SSR method while deprecating older SSR helpers.
⚠️ Breaking Changes
- Promise‑based query APIs no longer expose `loading`, `networkStatus`, and `partial` properties. Accessing these properties now throws or returns undefined. Update code to rely on promise resolution instead.
- Queries and mutations now throw an error if the link chain completes without emitting a value. Previously they would silently resolve. Add error handling for this new exception.
Migration Steps
- Remove any usage of `loading`, `networkStatus`, or `partial` on promise‑based query APIs such as `client.query`, `client.refetchQueries`, `client.reFetchObservableQueries`, `client.resetStore`, `observableQuery.fetchMore`, `observableQuery.refetch`, `observableQuery.reobserve`, `observableQuery.setVariables`, and the `execute` function returned by `useLazyQuery`.
- Replace deprecated SSR helpers (`getDataFromTree`, `getMarkupFromTree`, `renderToStringWithData`) with the new `prerenderStatic` API.
- Add try/catch or promise rejection handling for the new error thrown when a link chain completes without emitting a value.
✨ New Features
- Added a runtime error for queries and mutations when the link chain finishes without emitting a value.
- Added a `data` property to `CombinedGraphQLErrors` to expose any partial data returned alongside GraphQL errors.
- Introduced `prerenderStatic`, a new static SSR method for React components that supports React 19 suspense‑enabled APIs.
đź”§ Affected Symbols
client.queryclient.refetchQueriesclient.reFetchObservableQueriesclient.resetStoreobservableQuery.fetchMoreobservableQuery.refetchobservableQuery.reobserveobservableQuery.setVariablesuseLazyQuery.executeCombinedGraphQLErrorsprerenderStaticgetDataFromTreegetMarkupFromTreerenderToStringWithData⚡ Deprecations
- `getDataFromTree`, `getMarkupFromTree`, and `renderToStringWithData` are deprecated in favor of the new `prerenderStatic` method.