NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #4032 most downloaded on npm
A fully-featured caching GraphQL client.
Last release 6 days ago
11 Sep 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
27 versions withdrawn
withdrawn after publishing
7 years old
726 releases · first in 2019
## 3.8.0-alpha.2 ### Minor Changes - #10346 `3bcfc42d3` Thanks @jerelmiller! - Add the ability to allow @client fields to be sent to the link chain.
3bcfc42d3 Thanks @jerelmiller! - Add the ability to allow @client fields to be sent to the link chain.to 1. fix sourcemap warnings and 2. a Codesandbox sandpack (in-browser) bundler transpilation bug with an upstream optimism workaround.
#10888 1562a2f5a Thanks @alessbell! - Updates dependency versions in package.json by bumping:
@wry/context to ^0.7.3@wry/equality to ^0.5.6@wry/trie to ^0.4.3optimism to ^0.17.4to 1. fix sourcemap warnings and 2. a Codesandbox sandpack (in-browser) bundler transpilation bug with an upstream optimism workaround.
#10766 ffb179e55 Thanks @jerelmiller! - More robust typings for the data property returned from useSuspenseQuery when using returnPartialData: true or an errorPolicy of all or ignore. TData now defaults to unknown instead of any.
#10809 49d28f764 Thanks @jerelmiller! - Fixed the ability to use refetch and fetchMore with React's startTransition. The hook will now behave correctly by allowing React to avoid showing the Suspense fallback when these functions are wrapped by startTransition. This change deprecates the suspensePolicy option in favor of startTransition.
c2ce6496c Thanks @benjamn! - Allow ApolloCache implementations to specify default value for assumeImmutableResults client option, improving performance for applications currently using InMemoryCache without configuring new ApolloClient({ assumeImmutableResults: true })#10672 932252b0c Thanks @jerelmiller! - Fix the compatibility between useSuspenseQuery and React's useDeferredValue and startTransition APIs to allow React to show stale UI while the changes to the variable cause the component to suspend.
nextFetchPolicy support has been removed from useSuspenseQuery. If you are using this option, remove it, otherwise it will be ignored.
95eb228be Thanks @jerelmiller! - Add @defer support to useSuspenseQuery.One column per quarter.
## 3.8.0-alpha.0 ### Minor Changes - #10323 `64cb88a4b` Thanks @jerelmiller! - Add support for React suspense with a new useSuspenseQuery hook. ### Pa
64cb88a4b Thanks @jerelmiller! - Add support for React suspense with a new useSuspenseQuery hook.4f73c5ca1 Thanks @alessbell! - Avoid calling useQuery onCompleted for cache writes### Patch Changes - #10631 `b93388d75` Thanks @phryneas! - ObservableQuery.getCurrentResult: skip the cache if the running query should not access the
Previously, if the PersistedQueryLink encountered a single 400 or 500 error, it would stop sending any persisted queries in the future. This allowed y
#10806 cb1540504 Thanks @phryneas! - Fix a bug in PersistedQueryLink that would cause it to permanently skip persisted queries after a 400 or 500 status code.
#10807 b32369592 Thanks @phryneas! - PersistedQueryLink will now also check for error codes in extensions.
#10982 b9be7a814 Thanks @sdeleur-sc! - Update relayStylePagination to avoid populating startCursor when only a single cursor is present under the edges field. Use that cursor only as the endCursor.
#10962 772cfa3cb Thanks @jerelmiller! - Remove useGETForQueries option in BatchHttpLink.Options type since it is not supported.
PersistedQueryLinkPreviously, if the PersistedQueryLink encountered a single 400 or 500 error, it would stop sending any persisted queries in the future. This allowed you to use the link even if a server had no support for persisted queries.
We have decided to change this behavior, so now the PersistedQueryLink will only stop trying to send query hashes if the server responds with a PERSISTED_QUERY_NOT_SUPPORTED error code as it was unclear whether a 400 or 500 status code was in fact because the server did not support persisted queries.
If you relied on the previous behaviour, maybe because you were communicating with a server that might or might not support persisted queries, but would return with a different kind of error, you can use the disable option callback to override this behavior like this:
createPersistedQueryLink({
// ... other options ...
disable({ operation }){
const { response } = operation.getContext();
return (
response &&
response.status &&
(response.status === 400 || response.status === 500)
);
}
})
Alternatively, consider removing the link entirely when your server does not support persisted queries.
@AngadSethi made their first contribution in https://github.com/apollographql/apollo-client/pull/10837
#10891 ab42a5c08 Thanks @laverdet! - Fixes a bug in how multipart responses are read when using @defer. When reading a multipart body, HttpLink no longer attempts to parse the boundary (e.g. "---" or other boundary string) within the response data itself, only when reading the beginning of each mulitpart chunked message.
#10789 23a4e1578 Thanks @phryneas! - Fix a bug where other fields could be aliased to __typename or id, in which case an incoming result would be merged into the wrong cache entry.
In <3.7 HttpLink and BatchHttpLink would return a ServerError.message of e.g. "Unexpected token 'E', \"Error! Foo bar\" is not valid JSON" and a Serve
#10764 1b0a61fe5 Thanks @phryneas! - Deprecate useFragment returnPartialData option
#10810 a6252774f Thanks @dleavitt! - Fix type signature of ServerError.
In <3.7 HttpLink and BatchHttpLink would return a ServerError.message of e.g. "Unexpected token 'E', \"Error! Foo bar\" is not valid JSON" and a ServerError.result of undefined in the case where a server returned a >= 300 response code with a response body containing a string that could not be parsed as JSON.
In >=3.7, message became e.g. Response not successful: Received status code 302 and result became the string from the response body, however the type in ServerError.result was not updated to include the string type, which is now properly reflected.
### Patch Changes - #10805 `a5503666c` Thanks @phryneas! - Fix a potential memory leak in SSR scenarios when many persistedQuery instances were create
#10805 a5503666c Thanks @phryneas! - Fix a potential memory leak in SSR scenarios when many persistedQuery instances were created over time.
#10718 577c68bdd Thanks @Hsifnus! - Delay Concast subscription teardown slightly in useSubscription to prevent unexpected Concast teardown when one useSubscription hook tears down its in-flight Concast subscription immediately followed by another useSubscription hook reusing and subscribing to that same Concast
### Patch Changes - #10735 `895bcdcff` Thanks @alessbell! - If a multipart chunk contains only hasNext: false, immediately complete the observable.
895bcdcff Thanks @alessbell! - If a multipart chunk contains only hasNext: false, immediately complete the observable.Kicking off multiple requests in parallel with the execution function will now ensure each returned promise is resolved with the data from its request
#10586 4175af594 Thanks @alessbell! - Improve WebSocket error handling for generic Event received on error. For more information see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event.
#10411 152baac34 Thanks @lovasoa! - Simplify error message generation and make 'undefined' an impossible message string.
#10592 cdb98ae08 Thanks @alessbell! - Adds support for multipart subscriptions in HttpLink.
#10698 38508a251 Thanks @jerelmiller! - Changes the behavior of useLazyQuery introduced in #10427 where unmounting a component before a query was resolved would reject the promise with an abort error. Instead, the promise will now resolve naturally with the result from the request.
Other notable fixes:
useLazyQuery with a different query document will now ensure the execution function uses the updated query document. Previously, only the query document rendered the first time would be used for the request.#10660 364bee98f Thanks @alessbell! - Upgrades TypeScript to v5. This change is fully backward-compatible and transparent to users.
#10597 8fb9d190d Thanks @phryneas! - Fix a bug where an incoming cache update could prevent future updates from the active link.
#10629 02605bb3c Thanks @phryneas! - useQuery: delay unsubscribe to fix race conditions
### Patch Changes - #9438 `52a9c8ea1` Thanks @dciesielkiewicz! - Ensure the client option passed to useMutation's execute function is used when provid
#9438 52a9c8ea1 Thanks @dciesielkiewicz! - Ensure the client option passed to useMutation's execute function is used when provided. Previously this option was ignored.
#9124 975b923c0 Thanks @andrebrantom! - Make ApolloClient.writeQuery and ApolloClient.writeFragment behave more like cache.writeQuery and cache.writeFragment by returning the reference returned by the cache.
### Patch Changes - #10560 `a561ecf43` Thanks @benjamn! - Keep __typename fragment when it does not contain @client directive and strip out inline fra
#10560 a561ecf43 Thanks @benjamn! - Keep __typename fragment when it does not contain @client directive and strip out inline fragments which use a @client directive. Thanks @Gazler and @mtsmfm!
#10560 251a12806 Thanks @benjamn! - Refactor removeDirectivesFromDocument to fix AST ordering sensitivities and avoid 1/3 AST traversals, potentially improving performance for large queries
### Patch Changes - #7555 `45562d6fa` Thanks @TheCeloReis! - Adds TVariables generic to GraphQLRequest and MockedResponse interfaces. - #10526 `1d13de
#7555 45562d6fa Thanks @TheCeloReis! - Adds TVariables generic to GraphQLRequest and MockedResponse interfaces.
#10526 1d13de4f1 Thanks @benjamn! - Tolerate undefined concast.sources if complete called earlier than concast.start
#10497 8a883d8a1 Thanks @nevir! - Update SingleExecutionResult and IncrementalPayload's data types such that they no longer include undefined, which was not a valid runtime value, to fix errors when TypeScript's exactOptionalPropertyTypes is enabled.
### Patch Changes - #10502 `315faf9ca` Thanks @jerelmiller! - Log a warning to the console when a mock passed to MockedProvider or MockLink cannot be
#10502 315faf9ca Thanks @jerelmiller! - Log a warning to the console when a mock passed to MockedProvider or MockLink cannot be matched to a query during a test. This makes it easier to debug user errors in the mock setup, such as typos, especially if the query under test is using an errorPolicy set to ignore, which makes it difficult to know that a match did not occur.
#10499 9e54f5dfa Thanks @phryneas! - Allow the execution function returned by useLazyQuery to change the query.
#10362 14a56b105 Thanks @mccraveiro! - Fix error when server returns an error and we are also querying for a local field
OperationVariables, } from '@apollo/client';
47435e879 Thanks @alessbell! - Bumps TypeScript to 4.9.4 (previously 4.7.4) and updates types to account for changes in TypeScript 4.8 by propagating contstraints on generic types. Technically this makes some types stricter as attempting to pass null|undefined into certain functions is now disallowed by TypeScript, but these were never expected runtime values in the first place.
This should only affect you if you are wrapping functions provided by Apollo Client with your own abstractions that pass in their generics as type arguments, in which case you might get an error like error TS2344: Type 'YourGenericType' does not satisfy the constraint 'OperationVariables'. In that case, make sure that YourGenericType is restricted to a type that only accepts objects via extends, like Record<string, any> or @apollo/client's OperationVariables:import {
QueryHookOptions,
QueryResult,
useQuery,
+ OperationVariables,
} from '@apollo/client';
- export function useWrappedQuery<T, TVariables>(
+ export function useWrappedQuery<T, TVariables extends OperationVariables>(
query: DocumentNode,
queryOptions: QueryHookOptions<T, TVariables>
): QueryResult<T, TVariables> {
const [execute, result] = useQuery<T, TVariables>(query);
}
#10408 55ffafc58 Thanks @zlrlo! - fix: modify BatchHttpLink to have a separate timer for each different batch key
#9573 4a4f48dda Thanks @vladar! - Improve performance of local resolvers by only executing selection sets that contain an @client directive. Previously, local resolvers were executed even when the field did not contain @client. While the result was properly discarded, the unncessary work could negatively affect query performance, sometimes signficantly.
### Patch Changes - #10458 `b5ccef229` Thanks @lennyburdette! - Passes getServerSnapshot to useSyncExternalStore so that it doesn't trigger a Missing
#10458 b5ccef229 Thanks @lennyburdette! - Passes getServerSnapshot to useSyncExternalStore so that it doesn't trigger a Missing getServerSnapshot error when using useFragment_experimental on the server.
#10471 895ddcb54 Thanks @alessbell! - More robust type definition for headers property passed to createHttpLink
#10321 bbaa3ef2d Thanks @alessbell! - Refetch should not return partial data with errorPolicy: none and notifyOnNetworkStatusChange: true.
#10469 328c58f90 Thanks @jerelmiller! - Add generic type defaults when using useFragment to allow passing TData directly to the function without needing to specify TVars.
### Patch Changes - #10427 `28d909cff` Thanks @jerelmiller! - Ensure in-flight promises executed by useLazyQuery are rejected when useLazyQuery unmoun
#10427 28d909cff Thanks @jerelmiller! - Ensure in-flight promises executed by useLazyQuery are rejected when useLazyQuery unmounts.
#10383 5c5ca9b01 Thanks @jerelmiller! - Ensure the onError callback is called when the errorPolicy is set to "all" and partial data is returned.
#10425 86e35a6d2 Thanks @jerelmiller! - Prefer the onError and onCompleted callback functions passed to the execute function returned from useMutation instead of calling both callback handlers.
If the @defer directive is present in the document passed to mutate, the Promise will resolve with the final merged data after the last multipart chun
#10334 7d923939d Thanks @jerelmiller! - Better handle deferred queries that have cached or partial cached data for them
#10368 46b58e976 Thanks @alessbell! - Fix: unblocks support for defer in mutations
If the @defer directive is present in the document passed to mutate, the Promise will resolve with the final merged data after the last multipart chunk has arrived in the response.
Only show dev tools suggestion in the console when connectToDevTools is true. @chris110408 in #10258
CHANGELOG.md)Only show dev tools suggestion in the console when connectToDevTools is true.
@chris110408 in #10258
Pass TCache generic to MutationHookOptions for better type support in useMutation.
@igrlk in #10223
Add name property to ApolloError to ensure better type safety and help error reporting tools better identify the error.
@aaronadamsCA in #9323
Export a ModifierDetails type for the details parameter of a Modifier function.
@KeithGillette in #7133
Revert use of cloneDeep to clone options when fetching queries.
@MrDoomBringer in #10215
ModifierUtility type by @KeithGillette in https://github.com/apollographql/apollo-client/pull/7133Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.7.1...v3.7.2
Remove (deprecated) from Local resolvers doc title by @bignimbus in https://github.com/apollographql/apollo-client/pull/10213
CHANGELOG.md)Fix issue where loading remains true after observer.refetch is called repeatedly with different variables when the same data are returned.
@alessbell in #10143
Fix race condition where useFragment_experimental could receive cache updates before initially calling cache.watch in useEffect.
@benjamn in #10212
iterateObserversSafely if vars change between calls to observer.next by @alessbell in https://github.com/apollographql/apollo-client/pull/10143NetworkError by @OliverWales in https://github.com/apollographql/apollo-client/pull/10204config/bundlesize.ts script to avoid iltorb dependency, unbreaking npm install when using Node.js v19 by @benjamn in https://github.com/apollographql/apollo-client/pull/10206~/.npm directory during Filesize/Tests CircleCI jobs by @benjamn in https://github.com/apollographql/apollo-client/pull/10209forceUpdate immediately if diff changes between first useFragment call and first cache.watch call by @benjamn in https://github.com/apollographql/apollo-client/pull/10212Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.7.0...v3.7.1
Deprecate the onSubscriptionData callback in favor of a new onData callback for the useSubscription hook. Deprecate the onSubscriptionComplete callbac…
CHANGELOG.md)Implement preview support for the @defer directive.
@alessbell and @benjamn in #10018
Implement useFragment_experimental hook, which represents a lightweight live binding into the ApolloCache, and never triggers network requests of its own.
@benjamn in #8782
Allow registering named fragments with InMemoryCache to support using ...NamedFragment in queries without redeclaring NamedFragment repeatedly in every query that uses it.
@benjamn in #9764
Support onError callback for useSubscription hook.
@jeroenvisser101 in #9495
CHANGELOG.md)Delay calling onCompleted and onError callbacks passed to useQuery using Promise.resolve().then(() => ...) to fix issue #9794.
@dylanwulf in #9823
Replace concast.cleanup method with simpler concast.beforeNext API, which promises to call the given callback function just before the next result/error is delivered. In addition, concast.removeObserver no longer takes a quietly?: boolean parameter, since that parameter was partly responsible for cleanup callbacks sometimes not getting called.
@benjamn in #9718
Allow preserving header name capitalization when creating an HttpLink with createHttpLink({ uri, preserveHeaderCase: true }). Otherwise, header names are converted to lowercase to prevent case-sensitivity bugs.
@MrDoomBringer in #9891
Make queries with a pollInterval respect the no-cache fetch policy, instead of writing polled results into the cache.
@MrDoomBringer in #10020
Deprecate the onSubscriptionData callback in favor of a new onData callback for the useSubscription hook. Deprecate the onSubscriptionComplete callback in favor of a new onComplete callback for the useSubscription hook.
@jerelmiller in #10134
CHANGELOG.md)subscribeAndCount testing utility exported from @apollo/client/testing/core now takes a single generic TResult type parameter, instead of TData. This type will typically be inferred from the observable argument type, but if you have any explicit calls to subscribeAndCount<TData>(...) in your own codebase, you may need to adjust those calls accordingly.
@benjamn in #9718concast.cleanup method with simpler concast.beforeNext API by @benjamn in https://github.com/apollographql/apollo-client/pull/9718useFragment hook by @benjamn in https://github.com/apollographql/apollo-client/pull/8782BatchHttpLink regression that silently discarded some pending queries by @benjamn in https://github.com/apollographql/apollo-client/pull/9793hasDirectives utility function by @benjamn in https://github.com/apollographql/apollo-client/pull/10082defaultDataIdFromObject normalize objects with nullish ids by @benjamn in https://github.com/apollographql/apollo-client/pull/9862InMemoryCache to support using ...FragmentName in queries without redeclaring FragmentName in every query by @benjamn in https://github.com/apollographql/apollo-client/pull/9764@apollo/client@v3.7.0-rc.0 by @benjamn in https://github.com/apollographql/apollo-client/pull/10118Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.10...v3.7.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
The client options (variables, context, etc.) used for mutation calls are now available as the second argument to the onCompleted and onError callback
CHANGELOG.md)variables, context, etc.) used for mutation calls are now available as the second argument to the onCompleted and onError callback functions.
@MrDoomBringer in #10052WithApolloClient example by @charpeni in https://github.com/apollographql/apollo-client/pull/9977react-dom an optional peer dependency by @brillout in https://github.com/apollographql/apollo-client/pull/9933Modifier and Modifiers by @olyop in https://github.com/apollographql/apollo-client/pull/8973Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.9...v.3.6.10
removes deprecation language by @jpvajda in https://github.com/apollographql/apollo-client/pull/9825
CHANGELOG.md)fetchPolicy unchanged when skip: true (or in standby) and nextFetchPolicy is available, even if variables change.
@benjamn in #9823fetchPolicy unchanged when skip: true (or in standby) and nextFetchPolicy is available by @benjamn in https://github.com/apollographql/apollo-client/pull/9823Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.8...v3.6.9
Fix incorrect variables passed in FieldFunctionOptions for nested readField calls in read and merge functions. @stardustxx in #9808
CHANGELOG.md)Fix incorrect variables passed in FieldFunctionOptions for nested readField calls in read and merge functions.
@stardustxx in #9808
Improve repository build scripts to work better on Windows. @dylanwulf in #9805
Ensure useQuery(query, { skip: true }).called === false rather than always returning called as true.
@KucharskiPiotr in #9798
Allow abandoned reobserve requests to unsubscribe from their underlying Observable.
@javier-garcia-meteologica in #9791
Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.7...v3.6.8
Fix regression (introduced in v3.6.0) that caused BatchHttpLink to discard pending batched queries on early completion of the underlying Observable. @
CHANGELOG.md)BatchHttpLink to discard pending batched queries on early completion of the underlying Observable.
@benjamn in #9793release-3.7 branch to main by @benjamn in https://github.com/apollographql/apollo-client/pull/9807Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.6...v3.6.7
Allow useLazyQuery(query, { defaultOptions }) to benefit from defaultOptions.variables by @benjamn in https://github.com/apollographql/apollo-client/p
useLazyQuery(query, { defaultOptions }) to benefit from defaultOptions.variables by @benjamn in https://github.com/apollographql/apollo-client/pull/9762Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.5...v3.6.6
Restore pre-v3.6 variables replacement behavior of ObservableQuery#reobserve method, fixing a regression that prevented removal of variables. @benjamn
CHANGELOG.md)Restore pre-v3.6 variables replacement behavior of ObservableQuery#reobserve method, fixing a regression that prevented removal of variables.
@benjamn in #9741
Preserve previousData even when different query or client provided to useQuery, instead of resetting previousData to undefined in those cases, matching behavior prior to v3.6.0.
@benjamn in #9734
Fix bug where onCompleted() and onError() are stale for useMutation().
@charle692 in #9740
Limit scope of DeepMerger object reuse, and avoid using Object.isFrozen, which can introduce differences between development and production if objects that were frozen using Object.freeze in development are left unfrozen in production.
@benjamn in #9742
Properly merge variables from original useLazyQuery(query, { variables }) with variables passed to execution function.
@benjamn in #9758
previousData even when different client or query passed to useQuery by @benjamn in https://github.com/apollographql/apollo-client/pull/9734variables replacement behavior of ObservableQuery#reobserve method by @benjamn in https://github.com/apollographql/apollo-client/pull/9741DeepMerger mutable object reuse to fix subtle production-only bug by @benjamn in https://github.com/apollographql/apollo-client/pull/9742variables from original useLazyQuery(query, { variables }) with variables passed to execution function by @benjamn in https://github.com/apollographql/apollo-client/pull/9758Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.4...v3.6.5
apollo-codegen is deprecated, but the tooling documentation still suggests it by @krainboltgreene in https://github.com/apollographql/apollo-client/pu…
CHANGELOG.md)Guarantee Concast cleanup without Observable cancelled prematurely rejection, potentially solving long-standing issues involving that error.
@benjamn in #9701
Ensure useSubscription subscriptions are properly restarted after unmounting/remounting by React 18 in <StrictMode>.
@kazekyo in #9707
CHANGELOG.md)Internalize useSyncExternalStore shim, for more control than use-sync-external-store provides, fixing some React Native issues.
@benjamn in #9675 and #9709
Provide @apollo/client/**/*.cjs.native.js versions of every @apollo/client/**/*.cjs bundle (including dependencies ts-invariant and zen-observable-ts) to help React Native's Metro bundler automatically resolve CommonJS entry point modules. These changes should render unnecessary the advice we gave in the v3.5.4 section below about metro.config.js.
@benjamn in #9716
Handle falsy incoming data more gracefully in offetLimitPagination().merge function.
@shobhitsharma in #9705
useSyncExternalStore shim, for more control than use-sync-external-store provides by @benjamn in https://github.com/apollographql/apollo-client/pull/9675Concast cleanup without Observable cancelled prematurely rejection by @benjamn in https://github.com/apollographql/apollo-client/pull/9701readQuery clarification by @avinoamsn in https://github.com/apollographql/apollo-client/pull/9195useSyncExternalStore refinements by @benjamn in https://github.com/apollographql/apollo-client/pull/9709@apollo/client/main.cjs and other CommonJS bundles by @benjamn in https://github.com/apollographql/apollo-client/pull/9716Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.3...v3.6.4
Simplify useQuery(query, { defaultOptions }) default options processing in order to fix bug where skip: true queries failed to execute upon switching
CHANGELOG.md)Simplify useQuery(query, { defaultOptions }) default options processing in order to fix bug where skip: true queries failed to execute upon switching to skip: false.
@benjamn in #9665
Add tests of skipping/unskipping and useLazyQuery with defaultOptions, and fix a bug causing duplicate requests.
@benjamn in #9666
Update ts-invariant to version 0.10.2 to fix source map warnings.
@benjamn in #9672
Test that useQuery queries with skip: true do not stall server-side rendering.
@nathanmarks and @benjamn in #9677
Prevent useLazyQuery from making duplicate requests when its execution function is first called, and stop rejecting the Promise it returns when result.error is defined.
@benjamn in #9684
Fix issue with useQuery returning loading: true state during server-side rendering with skip: true.
@nathanmarks in #9679
useQuery default options processing by @benjamn in https://github.com/apollographql/apollo-client/pull/9665ts-invariant to version 0.10.2 to fix source map warnings by @benjamn in https://github.com/apollographql/apollo-client/pull/9672useQuery stuck in standby by @benjamn in https://github.com/apollographql/apollo-client/pull/9677useLazyQuery from making duplicate requests when execution function first called by @benjamn in https://github.com/apollographql/apollo-client/pull/9684useQuery returning loading: true state during server-side rendering with skip: true by @nathanmarks in https://github.com/apollographql/apollo-client/pull/9679Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.2...v3.6.3
fix Missing getServerSnapshot on React 18 and Next 12 by @hungphongbk in https://github.com/apollographql/apollo-client/pull/9652
Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.1...v3.6.2
getServerSnapshot function to useSyncExternalStore in addition to getSnapshot, though the two functions behave identically. This change should fix/unbreak React 18 server rendering. <br/>
@hungphongbk in #9652networkError.result.errors in addition to result.errors in PersistedQueryLink. <br/>
@redaid113 and @benjamn in #9410Remove WatchQueryOptions["fetchBlockingPromise"] option due to regressions by @benjamn in https://github.com/apollographql/apollo-client/pull/9636
WatchQueryOptions["fetchBlockingPromise"] option due to regressions by @benjamn in https://github.com/apollographql/apollo-client/pull/9636Full Changelog: https://github.com/apollographql/apollo-client/compare/v3.6.0...v3.6.1
Remove nagging deprecation warning about passing an options.updateQuery function to fetchMore. @benjamn in #9504
Note: for the most up-to-date version of this information, see
CHANGELOG.md
Calling fetchMore for queries using the cache-and-network or network-only fetch policies will no longer trigger additional network requests when cache results are complete. Instead, those complete cache results will be delivered as if using the cache-first fetch policy.
@benjamn in #9504
Reimplement useQuery and useLazyQuery to use the proposed useSyncExternalStore API from React 18.
@brainkim and @benjamn in #8785 and #9596
Fixed bug where the useLazyQuery execution function would always use the refetch method of ObservableQuery, instead of properly reapplying the current fetchPolicy using the reobserve method.
@benjamn in #9564
Since this
reobservemethod is useful and used internally, we have now exposed it asuse[Lazy]Query(...).reobserve(which optionally takes aPartial<WatchQueryOptions>of new options), to supplement the existingrefetchmethod. Note thatreobservepermanently updates thevariablesand other options of theObservableQuery, unlikerefetch({ ...variables }), which does not save thosevariables.
The internal use of options.fetchBlockingPromise by useQuery and useLazyQuery may slightly delay the delivery of network results, compared to previous versions of Apollo Client. Since network results are already delivered asynchronously, these timing differences should not be disruptive in most cases. Nevertheless, please open an issue if the timing differences cause problems for your applications.
@benjamn in #9599
In both its peerDependencies and its internal implementation, Apollo Client v3.6 should no longer prevent you from updating to React 18 in your applications.
Internally, we have refactored useQuery and useLazyQuery to be implemented in terms of React's new (shimmable) useSyncExternalStore hook, demonstrating Apollo Client can serve as an external store with a referentially stable, synchronous API, as needed by React.
As part of this refactoring, we also improved the behavior of useQuery and useLazyQuery when used in <React.StrictMode>, which double-renders components in development. While this double-rendering always results in calling useQuery twice, forcing Apollo Client to create and then discard an unnecessary ObservableQuery object, we now have multiple defenses in place against executing any network queries for the unused ObservableQuery objects.
In upcoming v3.6.x and v3.7 (beta) releases, we will be completely overhauling our server-side rendering utilities (getDataFromTree et al.), and introducing suspenseful versions of our hooks, to take full advantage of the new patterns React 18+ enables for data management libraries like Apollo Client.
Allow BatchLink to cancel queued and in-flight operations.
@PowerKiKi and @benjamn in #9248
Add GraphQLWsLink in @apollo/client/link/subscriptions. This link is similar to the existing WebSocketLink in @apollo/client/link/ws, but uses the newer graphql-ws package and protocol instead of the older subscriptions-transport-ws implementation. This functionality was technically first released in @apollo/client@3.5.10, but semantically belongs in the 3.6.0 minor version.
@glasser in #9369
Allow passing defaultOptions to useQuery to avoid clobbering/resetting existing options when useQuery is called repeatedly.
@benjamn in #9563, superseding #9223
Provide additional context to nextFetchPolicy functions to assist with fetchPolicy transitions. More details can be found in the nextFetchPolicy documentation.
@benjamn in #9222
Remove nagging deprecation warning about passing an options.updateQuery function to fetchMore.
@benjamn in #9504
Let addTypenameToDocument take any ASTNode (including DocumentNode, as before).
@benjamn in #9595
Set useMutation internal isMounted variable to true again when component remounted.
@devpeerapong in #9561
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →