apollo-cache-persist
apollo-cache-persist copied to clipboard
chore(deps): pin dependency @apollo/client to v3.6.9
This PR contains the following updates:
| Package | Type | Update | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|---|---|
| @apollo/client (source) | peerDependencies | pin | ^3.2.5 -> 3.6.9 |
||||
| @apollo/client (source) | devDependencies | minor | 3.2.4 -> 3.6.9 |
Add the preset :preserveSemverRanges to your config if you don't want to pin your dependencies.
Release Notes
apollographql/apollo-client
v3.6.9
Bug Fixes
- Leave
fetchPolicyunchanged whenskip: true(or in standby) andnextFetchPolicyis available, even ifvariableschange.
@​benjamn in #​9823
v3.6.8
Bug Fixes
-
Fix incorrect
variablespassed inFieldFunctionOptionsfor nestedreadFieldcalls inreadandmergefunctions.
@​stardustxx in #​9808 -
Improve repository build scripts to work better on Windows.
@​dylanwulf in #​9805 -
Ensure
useQuery(query, { skip: true }).called === falserather than always returningcalledastrue.
@​KucharskiPiotr in #​9798 -
Allow abandoned
reobserverequests to unsubscribe from their underlyingObservable.
@​javier-garcia-meteologica in #​9791
v3.6.7
Bug Fixes
- Fix regression (introduced in v3.6.0) that caused
BatchHttpLinkto discard pending batched queries on early completion of the underlyingObservable.
@​benjamn in #​9793
v3.6.6
Bug Fixes
- Allow
useLazyQuery(query, { defaultOptions })to benefit fromdefaultOptions.variablesandclient.defaultOptions.watchQuery.variablesmerging.
@​benjamn in #​9762
v3.6.5
Bug Fixes
-
Restore pre-v3.6
variablesreplacement behavior ofObservableQuery#reobservemethod, fixing a regression that prevented removal of variables.
@​benjamn in #​9741 -
Preserve
previousDataeven when different query or client provided touseQuery, instead of resettingpreviousDatato undefined in those cases, matching behavior prior to v3.6.0.
@​benjamn in #​9734 -
Fix bug where
onCompleted()andonError()are stale foruseMutation().
@​charle692 in #​9740 -
Limit scope of
DeepMergerobject reuse, and avoid usingObject.isFrozen, which can introduce differences between development and production if objects that were frozen usingObject.freezein development are left unfrozen in production.
@​benjamn in #​9742 -
Properly merge
variablesfrom originaluseLazyQuery(query, { variables })withvariablespassed to execution function.
@​benjamn in #​9758
v3.6.4
Bug Fixes
-
Guarantee
Concastcleanup withoutObservable cancelled prematurelyrejection, potentially solving long-standing issues involving that error.
@​benjamn in #​9701 -
Ensure
useSubscriptionsubscriptions are properly restarted after unmounting/remounting by React 18 in<StrictMode>.
@​kazekyo in #​9707
Improvements
-
Internalize
useSyncExternalStoreshim, for more control thanuse-sync-external-storeprovides, fixing some React Native issues.
@​benjamn in #​9675 and #​9709 -
Provide
@apollo/client/**/*.cjs.native.jsversions of every@apollo/client/**/*.cjsbundle (including dependenciests-invariantandzen-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 aboutmetro.config.js.
@​benjamn in #​9716 -
Handle falsy
incomingdata more gracefully inoffetLimitPagination().mergefunction.
@​shobhitsharma in #​9705
v3.6.3
Bug Fixes
-
Simplify
useQuery(query, { defaultOptions })default options processing in order to fix bug whereskip: truequeries failed to execute upon switching toskip: false.
@​benjamn in #​9665 -
Add tests of skipping/unskipping and
useLazyQuerywithdefaultOptions, and fix a bug causing duplicate requests.
@​benjamn in #​9666 -
Update
ts-invariantto version 0.10.2 to fix source map warnings.
@​benjamn in #​9672 -
Test that
useQueryqueries withskip: truedo not stall server-side rendering.
@​nathanmarks and @​benjamn in #​9677 -
Prevent
useLazyQueryfrom making duplicate requests when its execution function is first called, and stop rejecting thePromiseit returns whenresult.erroris defined.
@​benjamn in #​9684 -
Fix issue with
useQueryreturningloading: truestate during server-side rendering withskip: true.
@​nathanmarks in #​9679
v3.6.2
Bug Fixes
- Pass
getServerSnapshotfunction touseSyncExternalStorein addition togetSnapshot, though the two functions behave identically. This change should fix/unbreak React 18 server rendering.
@​hungphongbk in #​9652
Improvements
- Consider
networkError.result.errorsin addition toresult.errorsinPersistedQueryLink.
@​redaid113 and @​benjamn in #​9410
v3.6.1
Improvements
- The client options (
variables,context, etc.) used formutationcalls are now available as the second argument to theonCompletedandonErrorcallback functions.
@​MrDoomBringer in #​10052
v3.6.0
Potentially disruptive changes
-
Calling
fetchMorefor queries using thecache-and-networkornetwork-onlyfetch policies will no longer trigger additional network requests when cache results are complete. Instead, those complete cache results will be delivered as if using thecache-firstfetch policy.
@​benjamn in #​9504 -
Reimplement
useQueryanduseLazyQueryto use the proposeduseSyncExternalStoreAPI from React 18.
@​brainkim and @​benjamn in #​8785 and #​9596 -
Fixed bug where the
useLazyQueryexecution function would always use therefetchmethod ofObservableQuery, instead of properly reapplying the currentfetchPolicyusing thereobservemethod.
@​benjamn in #​9564Since 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.fetchBlockingPromisebyuseQueryanduseLazyQuerymay 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 are a problem for you (and you have no easy workaround).
@​benjamn in #​9599
React 18
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.
Improvements
-
Allow
BatchLinkto cancel queued and in-flight operations.
@​PowerKiKi and @​benjamn in #​9248 -
Add
GraphQLWsLinkin@apollo/client/link/subscriptions. This link is similar to the existingWebSocketLinkin@apollo/client/link/ws, but uses the newergraphql-wspackage and protocol instead of the oldersubscriptions-transport-wsimplementation. This functionality was technically first released in@apollo/[email protected], but semantically belongs in the 3.6.0 minor version. @​glasser in #​9369 -
Allow passing
defaultOptionstouseQueryto avoid clobbering/resetting existing options whenuseQueryis called repeatedly.
@​benjamn in #​9563, superseding #​9223 -
Provide additional context to
nextFetchPolicyfunctions to assist withfetchPolicytransitions. More details can be found in thenextFetchPolicydocumentation.
@​benjamn in #​9222 -
Remove nagging deprecation warning about passing an
options.updateQueryfunction tofetchMore.
@​benjamn in #​9504 -
Let
addTypenameToDocumenttake anyASTNode(includingDocumentNode, as before).
@​benjamn in #​9595 -
Set
useMutationinternalisMountedvariable totrueagain when component remounted.
@​devpeerapong in #​9561
v3.5.10
Improvements
-
Add
GraphQLWsLinkin@apollo/client/link/subscriptions. This link is similar to the existingWebSocketLinkin@apollo/client/link/ws, but uses the newergraphql-wspackage and protocol instead of the oldersubscriptions-transport-wsimplementation.
@​glasser in #​9369Note from @​benjamn: since
GraphQLWsLinkis new functionality, we would normally wait for the next minor version (v3.6), but we were asked to expedite this release. These changes are strictly additive/opt-in/backwards-compatible, so shipping them in a patch release (3.5.10) seems safe, if unusual.
v3.5.9
Improvements
-
Interpret
keyFields: [...]andkeyArgs: [...]configurations inInMemoryCachetype/field policies asReadonlyArrays, since they are never mutated internally.
@​julienfouilhe in #​9339 -
Avoid declaring a global type for the
__DEV__constant, to avoid conflict with other such global declarations.
@​benjamn in #​9386
Bug Fixes
-
Fix
useSubscriptionexecutingskipped subscription when input changes.
@​levrik in #​9299 -
Fix partial data appearing in
useQuery().datawhennotifyOnNetworkStatusChange: true.
@​brainkim in #​9367 -
Prevent
Promises returned byuseLazyQueryexecute functions from causing unhandledPromiserejection errors if uncaught.
@​brainkim in #​9380
v3.5.8
Bug Fixes
- Fix the type of the
calledproperty returned byuseQuery()anduseLazyQuery().
@​sztadii in #​9304
Bug Fixes (by @​brainkim in #​9328)
- Fix
refetch()not being called whenskipis true. - Fix the promise returned from the
useLazyQuery()execution function having stale variables. - Fix the promise returned from the
useLazyQuery()execution function not rejecting when a query errors.
v3.5.7
Bug Fixes
-
Fix regression that prevented calling
onErrororonCompletedin some cases when usinguseQuery.
@​mmahalwy in #​9226 -
Make
useQueryrespectdefaultOptions.watchQuery.fetchPolicy.
@​yasharzolmajdi in #​9210
v3.5.6
Bug Fixes (by @​brainkim in #​9144)
- Restores old behavior where the callback passed to
useMutation()is constant. - Fix
useMutation()callbacks having stale closures. - Fix
useQuery()variables being out of date.
v3.5.5
Bug Fixes
- Remove
printer: Printerpositional parameter from publicly-exportedselectHttpOptionsAndBodyfunction, whose addition in #​8699 was a breaking change (starting in Apollo Client 3.5.0) for direct consumers ofselectHttpOptionsAndBody.
@​benjamn in #​9103
v3.5.4
Notices
⚠️ The following advice about
metro.config.jsshould no longer be necessary, as of Apollo Client v3.6.4.
-
[Relevant if you use Apollo Client with React Native] Since Apollo Client v3.5.0, CommonJS bundles provided by
@apollo/clientuse a.cjsfile extension rather than.cjs.js, so Node.js won't interpret them as ECMAScript modules. While this change should be an implementation detail, it may cause problems for the Metro bundler used by React Native, whoseresolver.sourceExtsconfiguration does not include thecjsextension by default.As a workaround until this issue is resolved, you can configure Metro to understand the
.cjsfile extension by creating ametro.config.jsfile in the root of your React Native project:// NOTE: No longer necessary in @​apollo/[email protected]! const { getDefaultConfig } = require("metro-config"); const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues(); exports.resolver = { ...defaultResolver, sourceExts: [ ...defaultResolver.sourceExts, "cjs", ], };
Improvements
-
Restore the ability to pass
onError()andonCompleted()to the mutation execution function.
@​brainkim in #​9076 -
Work around webpack 5 errors of the form The request 'ts-invariant/process' failed to resolve only because it was resolved as fully specified by ensuring
import ... from 'ts-invariant/process'is internally written toimport ... from 'ts-invariant/process/index.js'.
@​benjamn in #​9083
v3.5.3
-
Avoid rewriting non-relative imported module specifiers in
config/rewriteModuleIds.tsscript, thereby allowing bundlers to resolve those imports as they see fit.
@​benjamn in #​9073 -
Ensure only current file is matched when running VSCode debugger.
@​eps1lon in #​9050
v3.5.2
- Fix
useMutationexecute function returning non-identical execution functions when passing similar options.
@​brainkim in #​9037
v3.5.1
Improvements
-
Add
GraphQLWsLinkin@apollo/client/link/subscriptions. This link is similar to the existingWebSocketLinkin@apollo/client/link/ws, but uses the newergraphql-wspackage and protocol instead of the oldersubscriptions-transport-wsimplementation.
@​glasser in #​9369Note from @​benjamn: since
GraphQLWsLinkis new functionality, we would normally wait for the next minor version (v3.6), but we were asked to expedite this release. These changes are strictly additive/opt-in/backwards-compatible, so shipping them in a patch release (3.5.10) seems safe, if unusual.
v3.5.0
Improvements
-
Add
updateQueryandupdateFragmentmethods toApolloCache, simplifying commonreadQuery/writeQuerycache update patterns.
@​wassim-k in #​8382 -
Field directives and their arguments can now be included along with field argument names when using field policy
keyArgs: [...]notation. For example, if you have aQuery.feedfield that takes an argument calledtypeand uses a@connection(key:...)directive to keepfeeddata from different queries separate within the cache, you might configure both using the followingInMemoryCachefield policy:new InMemoryCache({ typePolicies: { Query: { fields: { feed: { keyArgs: ["type", "@​connection", ["key"]], }, }, }, }, }) -
Report single
MissingFieldErrorinstead of a potentially very largeMissingFieldError[]array for incomplete cache reads, improving performance and memory usage.
@​benjamn in #​8734 -
When writing results into
InMemoryCache, each written object is now identified usingpolicies.identifyafter traversing the fields of the object (rather than before), simplifying identification and reducing duplicate work. If you have customkeyFieldsfunctions, they still receive the raw result object as their first parameter, but theKeyFieldsContextparameter now providescontext.storeObject(theStoreObjectjust processed byprocessSelectionSet) andcontext.readField(a helper function for reading fields fromcontext.storeObjectand anyReferences it might contain, similar toreadFieldforread,merge, andcache.modifyfunctions).
@​benjamn in #​8996 -
Ensure
cache.identifynever throws when primary key fields are missing, and include the source object in the error message whenkeyFieldsprocessing fails.
@​benjamn in #​8679 -
The
HttpLinkconstructor now accepts an optionalprintfunction that can be used to customize how GraphQLDocumentNodeobjects are transformed back into strings before they are sent over the network.
@​sarahgp in #​8699 -
Make
@apollo/client/testinga fully-fledged, independent entry point, instead of re-exporting@apollo/client/utilities/testing(which was never an entry point and no longer exists).
@​benjamn in #​8769 -
A new nested entry point called
@apollo/client/testing/corehas been created. Importing from this entry point instead of@apollo/client/testingexcludes any React-related dependencies.
@​wassim-k in #​8687 -
Make
cache.batchreturn the result of calling theoptions.updatefunction.
@​benjamn in #​8696 -
The
NetworkErrorandErrorResponsetypes have been changed to align more closely.
@​korywka in #​8424 -
Include
graphql@16in peer deps.
@​brainkim in #​8997 -
Update
zen-observable-tsto eliminate transitive dependency on@types/zen-observable.
@​benjamn in #​8695
React Refactoring
Improvements (due to @​brainkim in #​8875):
- The
useLazyQueryfunction now returns a promise with the result. - The
useMutationresult now exposes a method which can be reset.
Bug Fixes (due to @​brainkim in #​8596):
- The
useQueryanduseLazyQueryhooks will now haveObservableQuerymethods defined consistently. - Calling
useLazyQuerymethods likestartPollingwill start the query. - Calling the
useLazyQueryexecution function will now behave more likerefetch.previousDatawill be preserved. standbyfetchPolicies will now act likeskip: truemore consistently.- Calling
refetchon a skipped query will have no effect (issue #​8270). - Prevent
onErrorandonCompletedfunctions from firing continuously, and improving their polling behavior.
v3.4.17
Improvements
- Allow
TOptions extends FieldFunctionOptionsto be passed as final (optional) type parameter ofFieldPolicytype.
@​VictorGaiva in #​9000
v3.4.16
Improvements
-
Prevent webpack from misresolving the
graphqlpackage as the local@apollo/client/utilities/globals/graphql.jsmodule whenmodule.exports.resolve.preferRelativeis enabled inwebpack.config.js.Note: if you encounter strange module resolution errors like
export 'isType' (imported as 'isType') was not found in 'graphql' (possible exports: removeTemporaryGlobals)please try removingpreferRelative: truefrom yourwebpack.config.jsfile, or find a way to disable that resolution behavior for packages withinnode_modules. -
Avoid importing
isTypefrom thegraphqlpackage internally, to prevent bundlers from including as much as 3.4kB of unnecessary code.
@​benjamn in #​8891 -
Make
client.resetStoreandclient.clearStorepass appropriatediscardWatchesoption tocache.reset.
@​benjamn in #​8873
v3.4.15
Bug Fixes
- Require calling
cache.reset({ discardWatches: true })to makecache.resetdiscardcache.watches, restoring behavior broken in v3.4.14 by #​8826.
@​benjamn in #​8852
v3.4.14
Bug Fixes
-
Disable
InMemoryCacheresult object canonization by default, to prevent unexpected memory growth and/or reuse of object references, with multiple ways to reenable it (per-cache, per-query, or a mixture of both).
@​benjamn in #​8822 -
Clear
InMemoryCachewatchesset whencache.reset()called.
@​benjamn in #​8826 -
Stop excluding observerless queries from
refetchQueries: [...]selection.
@​benjamn in #​8825 -
Prevent optimistic cache evictions from evicting non-optimistic data.
@​benjamn in #​8829 -
Ensure
cache.broadcastWatchpasses all relevantWatchOptionstocache.diffasDiffOptions.
@​benjamn in #​8832
v3.4.13
Bug Fixes
-
Fix
componentDidUpatetypo inwithSubscriptionhigher-order component.
@​YarBez in #​7506 -
Fix internal
canUseSymbolimport within@apollo/client/utilitiesto avoid breaking bundlers/builds.
@​benjamn in #​8817 -
Tolerate unfreezable objects like
Uint8ArrayandBufferinmaybeDeepFreeze.
@​geekuillaume and @​benjamn in #​8813
v3.4.12
Bug Fixes
-
Improve handling of falsy
existingand/orincomingparameters inrelayStylePaginationfield policy helper function.
@​bubba and @​benjamn in #​8733 -
Associate Apollo context with
React.createContext(instead of using a localWeakMap) again, so multiple copies of@apollo/client(uncommon) can share the same context.
@​benjamn in #​8798
v3.4.11
Bug Fixes
- Fix Vite tree-shaking by calling the
checkDEV()function (at least once) in the module that exports it,@apollo/client/utilities/globals/index.ts.
@​benjamn in #​8767
Improvements
- Export
PersistedQueryLinknamespace from@apollo/client/link/persisted-queries.
@​vedrani in #​8761
Documentation
- Upgrade docs theme for new Algolia-powered search experience.
@​trevorblades in #​8768
v3.4.10
Improvements
- Warn when calling
refetch({ variables })instead ofrefetch(variables), except for queries that declare a variable named$variables(uncommon).
@​benjamn in #​8702
Bug Fixes
-
Fix
ObservableQuery.getCurrentResult()returning cacheddatawith certain fetch policies.
@​brainkim in #​8718 -
Prevent
ssrMode/ssrForceFetchDelayfrom causing queries to hang.
@​brainkim in #​8709 -
Import
@apollo/client/utilities/globalsinternally wherever__DEV__is used, not just in@apollo/client/**/index.jsentry points.
@​benjamn in #​8720
v3.4.9
Bug Fixes
-
Fix unhandled
Promiserejection warnings/errors whose message isObservable cancelled prematurely.
@​benjamn in #​8676 -
Enforce that
__DEV__is polyfilled by every@apollo/client/*entry point that uses it. This build step considers not only explicit__DEV__usage but also__DEV__references injected nearinvariant(...)andnew InvariantError(...)expressions.
@​benjamn in #​8689
v3.4.8
Bug Fixes
-
Fix error thrown by nested
keyFields: ["a", ["b", "c"], "d"]type policies when writing results into the cache where any of the key fields (.a,.a.b,.a.c, or.d) have been renamed by query field alias syntax.
@​benjamn in #​8643 -
Fix regression from PR #​8422 (first released in
@apollo/[email protected]) that causedresult.datato be set to undefined in some cases afterObservableQuery#getCurrentResultreads an incomplete result from the cache.
@​benjamn in #​8642
v3.4.7
Bug Fixes
- Fix accidental reuse of recycled
MergeTreeobjects inStoreWriterclass used byInMemoryCache.
@​benjamn in #​8618
v3.4.6
Improvements
-
Reevaluate
window.fetcheach timeHttpLinkuses it, if not configured usingoptions.fetch. This change enables a variety of strategies for instrumentingwindow.fetch, without requiring those strategies to run before@apollo/client/link/httpis first imported.
@​benjamn in #​8603 -
Clarify mutation
fetchPolicyoptions ("network-only"or"no-cache") usingMutationFetchPolicyunion type.
@​benjamn in #​8602
Bug Fixes
-
Restore full
@apollo/client/apollo-client.cjs.jsCommonJS bundle for older bundlers.Note that Node.js and CommonJS bundlers typically use the bundles specified by
"main"fields in our generatedpackage.jsonfiles, which are all independent and non-overlapping CommonJS modules. However,apollo-client.cjs.jsis just one big bundle, so mixing imports ofapollo-client.cjs.jswith the other CommonJS bundles is discouraged, as it could trigger the dual package hazard. In other words, please don't start usingapollo-client.cjs.jsif you're not already. -
Log
MissingFieldErrors inObservableQuery#getCurrentResultusinginvariant.debug, rather than reporting them viaresult.error.
@​benjamn in #​8604
v3.4.5
Bug Fixes
-
Fix double registration bug for mutation
refetchQueriesspecified using legacy one-timerefetchQueries: [{ query, variables }]style. Though the bug is fixed, we recommend usingrefetchQueries: [query]instead (when possible) to refetch an existing query using itsDocumentNode, rather than creating, executing, and then deleting a new query, as the legacy{ query, variables }style unfortunately does.
@​benjamn in #​8586 -
Fix
useQuery/useLazyQuerystalling when clients or queries change.
@​brainkim in #​8589
v3.4.4
Bug Fixes
- Revert accidental addition of
engines.npmsection to published version of@apollo/client/package.json.
@​benjamn in #​8578
v3.4.3
Bug Fixes
- Fix
{ ssr: false }causing queries to hang on the client.
@​brainkim in #​8574
v3.4.2
Bug Fixes
- Use more default type parameters for mutation-related types in
react/types/types.ts, to provide smoother backwards compatibility for code using those types explicitly.
@​benjamn in #​8573
v3.4.1
Improvements
- Allow
TOptions extends FieldFunctionOptionsto be passed as final (optional) type parameter ofFieldPolicytype.
@​VictorGaiva in #​9000
v3.4.0
New documentation
- Refetching queries with
client.refetchQueries.
@​StephenBarlow and @​benjamn in #​8265
Improvements
-
InMemoryCachenow guarantees that any two result objects returned by the cache (fromreadQuery,readFragment, etc.) will be referentially equal (===) if they are deeply equal. Previously,===equality was often achievable for results for the same query, on a best-effort basis. Now, equivalent result objects will be automatically shared among the result trees of completely different queries. This guarantee is important for taking full advantage of optimistic updates that correctly guess the final data, and for "pure" UI components that can skip re-rendering when their input data are unchanged.
@​benjamn in #​7439 -
Mutations now accept an optional callback function called
onQueryUpdated, which will be passed theObservableQueryandCache.DiffResultobjects for any queries invalidated by cache writes performed by the mutation's finalupdatefunction. UsingonQueryUpdated, you can override the defaultFetchPolicyof the query, by (for example) callingObservableQuerymethods likerefetchto force a network request. This automatic detection of invalidated queries provides an alternative to manually enumerating queries using therefetchQueriesmutation option. Also, if you return aPromisefromonQueryUpdated, the mutation will automatically await thatPromise, rendering theawaitRefetchQueriesoption unnecessary.
@​benjamn in #​7827 -
Support
client.refetchQueriesas an imperative way to refetch queries, without having to passoptions.refetchQueriestoclient.mutate.
@​dannycochran in #​7431 -
Improve standalone
client.refetchQueriesmethod to support automatic detection of queries needing to be refetched.
@​benjamn in #​8000 -
Fix remaining barriers to loading
@apollo/client/coreas native ECMAScript modules from a CDN like esm.run. Importing@apollo/clientfrom a CDN will become possible once we move all React-related dependencies into@apollo/client/reactin Apollo Client 4.
@​benjamn in #​8266 -
InMemoryCachesupports a new method calledbatch, which is similar toperformTransactionbut takes named options rather than positional parameters. One of these named options is anonDirty(watch, diff)callback, which can be used to determine which watched queries were invalidated by thebatchoperation.
@​benjamn in #​7819 -
Allow
merge: truefield policy to mergeReferenceobjects with non-normalized objects, and vice-versa.
@​benjamn in #​7778 -
Allow identical subscriptions to be deduplicated by default, like queries.
@​jkossis in #​6910 -
Always use
POSTrequest when falling back to sending full query with@apollo/client/link/persisted-queries.
@​rieset in #​7456 -
The
FetchMoreQueryOptionstype now takes two instead of three type parameters (<TVariables, TData>), thanks to usingPartial<TVariables>instead ofK extends typeof TVariablesandPick<TVariables, K>.
@​ArnaudBarre in #​7476 -
Pass
variablesandcontextto a mutation'supdatefunction. Note: The type of theupdatefunction is now namedMutationUpdaterFunctionrather thanMutationUpdaterFn, since the older type was broken beyond repair. If you are usingMutationUpdaterFnin your own code, please useMutationUpdaterFunctioninstead.
@​jcreighton in #​7902 -
A
resultCacheMaxSizeoption may be passed to theInMemoryCacheconstructor to limit the number of result objects that will be retained in memory (to speed up repeated reads), and callingcache.reset()now releases all such memory.
@​SofianHn in #​8107 -
Fully remove result cache entries from LRU dependency system when the corresponding entities are removed from
InMemoryCacheby eviction, or by any other means.
@​sofianhn and @​benjamn in #​8147 -
Expose missing field errors in results.
@​brainkim in #​8262 -
Add expected/received
variablestoNo more mocked responses...error messages generated byMockLink.
@​markneub in #​8340 -
The
InMemoryCacheversion of thecache.gcmethod now supports additional options for removing non-essential (recomputable) result caching data.
@​benjamn in #​8421 -
Suppress noisy
Missing cache result fields...warnings by default unlesssetLogVerbosity("debug")called.
@​benjamn in #​8489 -
Improve interaction between React hooks and React Fast Refresh in development.
@​andreialecu in #​7952
Potentially disruptive changes
-
To avoid retaining sensitive information from mutation root field arguments, Apollo Client v3.4 automatically clears any
ROOT_MUTATIONfields from the cache after each mutation finishes. If you need this information to remain in the cache, you can prevent the removal by passing thekeepRootFields: trueoption toclient.mutate.ROOT_MUTATIONresult data are also passed to the mutationupdatefunction, so we recommend obtaining the results that way, rather than usingkeepRootFields: true, if possible.
@​benjamn in #​8280 -
Internally, Apollo Client now controls the execution of development-only code using the
__DEV__global variable, rather thanprocess.env.NODE_ENV. While this change should not cause any visible differences in behavior, it will increase your minified+gzip bundle size by more than 3.5kB, unless you configure your minifier to replace__DEV__with atrueorfalseconstant, the same way you already replaceprocess.env.NODE_ENVwith a string literal like"development"or"production". For an example of configuring a Create React App project without ejecting, see this pull request for our React Apollo reproduction template.
@​benjamn in #​8347 -
Internally, Apollo Client now uses namespace syntax (e.g.
import * as React from "react") for imports whose types are re-exported (and thus may appear in.d.tsfiles). This change should remove any need to configureesModuleInteroporallowSyntheticDefaultImportsintsconfig.json, but might require updating bundler configurations that specify named exports of thereactandprop-typespackages, to include exports likecreateContextandcreateElement(example).
@​devrelm in #​7742 -
Respect
no-cachefetch policy (by not reading anydatafrom the cache) forloading: trueresults triggered bynotifyOnNetworkStatusChange: true.
@​jcreighton in #​7761 -
The TypeScript return types of the
getLastResultandgetLastErrormethods ofObservableQuerynow correctly include the possibility of returningundefined. If you happen to be calling either of these methods directly, you may need to adjust how the calling code handles the methods' possibly-undefinedresults.
@​benjamn in #​8394 -
Log non-fatal
invariant.errormessage when fields are missing from result objects written into `InMemory
Configuration
đź“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
- [ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by Mend Renovate. View repository job log here.