chore: update npm dependencies#6
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
a1087a0 to
75c8e9c
Compare
60cb682 to
80600c5
Compare
80600c5 to
6632f29
Compare
833ff34 to
08e7299
Compare
ba4d2f6 to
9d8c7f7
Compare
0b275da to
3d7b736
Compare
3d7b736 to
708c99a
Compare
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
3.8.1→4.2.04.2.2(+1)^1.3.3→^5.2.111.11.0→11.14.21.5.4→1.6.28.0.8→8.6.148.0.8→8.6.148.0.8→10.4.110.4.28.0.8→10.4.110.4.28.0.8→8.6.148.0.8→10.4.110.4.28.0.8→10.4.110.4.28.0.8→8.6.156.1.4→6.9.114.0.0→16.3.26.5.0→7.3.56.5.0→7.3.57946.0.14→7946.0.160.7.2→0.8.020.12.7→24.12.424.13.1(+1)2.5.5→2.19.018.2.6→19.2.1519.2.17(+1)18.2.6→19.2.39.0.8→11.0.07.2.0→8.60.08.60.17.2.0→8.60.08.60.14.2.1→6.0.23.2.1→6.1.05.5.2→6.2.18.57.0→10.4.10.3.0→0.4.04.6.0→7.1.10.4.6→0.5.20.8.0→10.4.110.4.24.3.2→5.8.011.0.27→12.40.02.1.1→4.2.31.12.1→2.20.00.7.3→0.8.322.1.0→29.1.11.3.8→1.4.07.2.0→10.4.04.17.21→4.18.18.0.4→11.5.1>=20→>=24.16.03.2.1→5.1.03.2.5→3.8.32.11.0→2.20.81.23.1→2.0.1^18.2.0→^19.2.619.2.718.2.0→19.2.619.2.7^18.2.0→^19.2.619.2.718.2.0→19.2.619.2.74.0.11→6.1.217.5.0→17.6.01.17.4→1.22.01.23.08.0.8→10.4.110.4.25.2.2→6.0.31.3.2→1.3.31.4.0→1.5.09.0.1→14.0.05.0.8→8.0.148.0.16(+1)3.8.1→5.0.15.0.24.2.0→5.2.0^4.3.2→^6.1.11.0.4→4.1.74.1.83.2.1→4.3.04.38.2→5.32.0Release Notes
apollographql/apollo-client (@apollo/client)
v4.2.0Compare Source
Minor Changes
#13132
f3ce805Thanks @phryneas! - Introduce "classic" and "modern" method and hook signatures.Apollo Client 4.2 introduces two signature styles for methods and hooks. All signatures previously present are now "classic" signatures, and a new set of "modern" signatures are added alongside them.
Classic signatures are the default and are identical to the signatures before Apollo Client 4.2, preserving backward compatibility. Classic signatures still work with manually specified TypeScript generics (e.g.,
useSuspenseQuery<MyData>(...)). However, manually specifying generics has been discouraged for a long time—instead, we recommend usingTypedDocumentNodeto automatically infer types, which provides more accurate results without any manual annotations.Modern signatures automatically incorporate your declared
defaultOptionsinto return types, providing more accurate types. Modern signatures infer types from the document node and do not support manually passing generic type arguments; TypeScript will produce a type error if you attempt to do so.Methods and hooks automatically switch to modern signatures the moment any non-optional property is declared in
DeclareDefaultOptions. The switch happens across all methods and hooks globally:Users can also manually switch to modern signatures without declaring any
defaultOptions, for example when wanting accurate type inference without relying on globaldefaultOptions:Users can do a global
DeclareDefaultOptionstype augmentation and then manually switch back to "classic" for migration purposes:Note that this is not recommended for long-term use. When combined with
DeclareDefaultOptions, switching back to classic results in the same incorrect types as before Apollo Client 4.2—methods and hooks will not reflect thedefaultOptionsyou've declared.#13130
dd12231Thanks @jerelmiller! - Improve the accuracy ofclient.queryreturn type to better detect the currenterrorPolicy. Thedataproperty is no longer nullable when theerrorPolicyisnone. This makes it possible to remove theundefinedchecks or optional chaining in most cases.#13210
1f9a428Thanks @jerelmiller! - Add support for automatic event-based refetching, such as window focus.The
RefetchEventManagerclass handles automatic refetches in response to events. Apollo Client provides built-in sources for window focus and network reconnect aswindowFocusSourceandonlineSource.Event refetching is fully opt-in. Create and pass a
RefetchEventManagerinstance to theApolloClientconstructor to activate the event listeners.By default, all active queries refetch when the events fire. Queries can opt out per-event or disable all event refetches:
To enable per-query opt-in rather than opt-out, set
defaultOptions.watchQuery.refetchOntofalseand enable it per-query instead.When
defaultOptions.watchQuery.refetchOnand per-queryrefetchOnoptions are provided, the objects are merged together.Custom events
You can also add your own custom events that trigger refetches. Register your event name and payload type using TypeScript module augmentation, then provide a source function that returns an Observable. The source's emitted value becomes the event's
payload.Manually trigger an event refetch
Refetches can be triggered imperatively by calling
emitwith the event name and its payload (if any).Sourceless events
A source that has no automatic detection logic but still wants imperative
emitsupport can be declared astrue. Type the event asvoidto omit the payload argument.Note: Calling
emiton an event without a registered source will log a warning and result in a no-op.Custom handlers
When an event fires, the default handler calls
client.refetchQueries({ include: "active" })filtered by each query'srefetchOnsetting. You can override the handler for an event to add your own custom filtering. For example, to refetch all queries, includingstandbyqueries, define a handler for the event:Handlers must return either a
RefetchQueriesResultorvoid. Returningvoidskips refetching for the event.#13232
f1b541fThanks @jerelmiller! - Version bump torc.#13206
08fccabThanks @jerelmiller! - Extend thedefaultOptionstype-safety work toclient.mutateanduseMutation.The
errorPolicyoption now flows through to the result types for mutations in the same way it already does for queries:ApolloClient.MutateResult<TData, TErrorPolicy>mapserrorPolicyto the concrete shape ofdataanderror:"none"→{ data: TData; error?: never }"all"→{ data: TData | undefined; error?: ErrorLike }"ignore"→{ data: TData | undefined; error?: never }client.mutateanduseMutationpick up the declareddefaultOptions.mutate.errorPolicyand the expliciterrorPolicyon each call to narrow return types accordingly.useMutation.Result.erroris narrowed toundefinedwhenerrorPolicyis"ignore", sinceclient.mutatenever resolves with an error in that case.DeclareDefaultOptions.Mutatealready acceptederrorPolicy; the new behavior is that once you declare it, hook and method return types reflect it:Setting
errorPolicyon an individual call overrides the default for that call's return type.#13222
b93c172Thanks @jerelmiller! - Extend thedefaultOptionstype-safety work topreloadQuery(returned fromcreateQueryPreloader). Defaults declared inDeclareDefaultOptions.WatchQuerynow work withpreloadQueryto ensure thePreloadedQueryRef's data states are correctly set.#13132
f3ce805Thanks @phryneas! - Synchronize method and hook return types withdefaultOptions.Prior to this change, the following code snippet would always apply:
While these types are generally correct, if you were to set
errorPolicy: 'all'as a default option, the type ofresult.datafor the first query would remainTDatainstead of changing toTData | undefinedto match the runtime behavior.We are now enforcing that certain
defaultOptionstypes need to be registered globally. This means that if you want to useerrorPolicy: 'all'as a default option for a query, you will need to register its type like this:Once this type declaration is in place, the type of
result.datain the above example will correctly be changed toTData | undefined, reflecting the possibility that if an error occurs,datamight beundefined. Manually specifyinguseSuspenseQuery(MY_QUERY, { errorPolicy: "none" });changesresult.datatoTDatato reflect the local override.This change means that you will need to declare your default options types in order to use
defaultOptionswithApolloClient, otherwise you will see a TypeScript error.Without the type declaration, the following (previously valid) code will now error:
If you are creating multiple instances of Apollo Client with conflicting default options and you cannot register a single
defaultOptionsvalue as a result, you can relax the constraints by declaring those options as union types covering all values used by all clients. The properties can be required (to enforce them indefaultOptions) or optional (if some constructor calls won't pass a value):With this declaration, the
ApolloClientconstructor accepts any of those values indefaultOptions. The tradeoff is that hook and method return types become more generic. For example, callinguseSuspenseQuerywithout an expliciterrorPolicywill return a result typed as if all error policies are possible, since TypeScript can't know which specific value your instance uses at runtime.Note that making a property optional (
errorPolicy?:) is equivalent to adding the TypeScript default value ("none") to the union. SoerrorPolicy?: "all" | "ignore"has the same effect on return types aserrorPolicy: "none" | "all" | "ignore", because TypeScript assumes the option could also be absent (i.e.,"none").You can also use a partial union that only lists the values you actually use. For example, if you only ever use
"all"or"ignore", declareerrorPolicy: "all" | "ignore"(required) to keep the union narrow and avoid unused values broadening your signatures unnecessarily.Patch Changes
#13217
790f987Thanks @jerelmiller! - Fix the deprecation for the classic signatures for function overloads that rely on type inference from aTypedDocumentNode. The deprecation now only applies to classic signatures that provide explicit type arguments to encourage the use ofTypedDocumentNode.#13166
0537d97Thanks @jerelmiller! - Release changes in 4.1.5 and 4.1.6.#13215
54c9eb7Thanks @jerelmiller! - Ensure the options object for theuseQuery,useSuspenseQuery, anduseBackgroundQueryhooks provide proper IntelliSense suggestions.#13229
9a7f65aThanks @jerelmiller! - FixrefetchOnmerging whendefaultOptions.watchQuery.refetchOnis set to a non-object value (false,true, or a function) and the per-queryrefetchOnis an object. Previously the per-query object completely replaced the default so unspecified events fell back to "enabled" regardless of the default.The
defaultOptionsvalue now applies to any event the per-query object does not explicitly configure:false- unspecified events stay disabledtrue- unspecified events refetch#13230
b25b659Thanks @jerelmiller! - Add the ability to override the default event handler onRefetchEventManager. The default handler runs when no per-source handler is configured for an event. Provide a custom handler via thedefaultHandlerconstructor option or thesetDefaultEventHandlerinstance method.v4.1.9Compare Source
Patch Changes
099954bThanks @copilot-swe-agent! - Remove theworkspacesfield from the publishedpackage.jsonindistto avoid Yarn v1 warnings about workspaces requiring private packages.v4.1.8Compare Source
Patch Changes
8a51ea6Thanks @phryneas! - Ship agent skill for usage with @tanstack/intent — the skill is now bundled in the npm package underskills/apollo-client/and discoverable byintent list.For more context, see the TanStack Intent QuickStart.
v4.1.7Compare Source
v4.1.6Compare Source
v4.1.5Compare Source
v4.1.4Compare Source
v4.1.3Compare Source
v4.1.2Compare Source
v4.1.1Compare Source
v4.1.0Compare Source
v4.0.13Compare Source
v4.0.12Compare Source
v4.0.11Compare Source
v4.0.10Compare Source
v4.0.9Compare Source
v4.0.8Compare Source
v4.0.7Compare Source
Patch Changes
5b4f36aThanks @jerelmiller! - Don't sendoperationTypein the payload sent byGraphQLWsLink.v4.0.6Compare Source
Patch Changes
3b0d89bThanks @phryneas! - Fix a problem withfetchMorewhere the loading state wouldn't reset if the result wouldn't result in a data update.v4.0.5Compare Source
Patch Changes
e2fc385Thanks @phryneas! - Fix an invariance type error in theMockedResponsetype.v4.0.4Compare Source
Patch Changes
#12892
db8a04bThanks @jerelmiller! - Prevent unhandled rejections from the promise returned by calling themutatefunction from theuseMutationhook.#12899
5352c12Thanks @phryneas! - Fix an issue wheninvariantis called by external libraries when no dev error message handler is loaded.#12895
71f2517Thanks @jerelmiller! - SupportskipTokenwithuseQueryto provide a more type-safe way to skip query execution.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR was generated by Mend Renovate. View the repository job log.