From 73758917d1983caae6790dc66a57cc73dd474b20 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 12:51:26 +0000 Subject: [PATCH] ci: apply automated fixes --- .../angular/reference/classes/QueryClient.md | 52 ++++++++++--------- .../lit/reference/classes/QueryClient.md | 52 ++++++++++--------- .../preact/reference/classes/QueryClient.md | 52 ++++++++++--------- .../react/reference/classes/QueryClient.md | 52 ++++++++++--------- .../solid/reference/classes/QueryClient.md | 52 ++++++++++--------- .../svelte/reference/classes/QueryClient.md | 52 ++++++++++--------- .../vue/reference/classes/QueryClient.md | 28 +++++----- 7 files changed, 184 insertions(+), 156 deletions(-) diff --git a/docs/framework/angular/reference/classes/QueryClient.md b/docs/framework/angular/reference/classes/QueryClient.md index 4863483a0c..5ad37c2463 100644 --- a/docs/framework/angular/reference/classes/QueryClient.md +++ b/docs/framework/angular/reference/classes/QueryClient.md @@ -104,7 +104,7 @@ await queryClient.cancelQueries({ queryKey: ['posts'], exact: true }) clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -129,7 +129,7 @@ queryClient.clear() defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -166,7 +166,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -223,7 +223,7 @@ The defaulted options, with `queryHash` and dependent defaults (e.g. ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -329,7 +329,7 @@ Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:751](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L751) +Defined in: [packages/query-core/src/queryClient.ts:754](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L754) Fetches and caches an infinite query, or returns its cached data if it isn't stale. @@ -383,7 +383,7 @@ Use queryClient.infiniteQuery(options) instead. This method will be removed in t fetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:645](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L645) +Defined in: [packages/query-core/src/queryClient.ts:648](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L648) Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers, the fetch isn't retried unless `retry` is set. @@ -438,7 +438,7 @@ Use queryClient.query(options) instead. This method will be removed in the next getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -466,7 +466,7 @@ const defaultOptions = queryClient.getDefaultOptions() getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -494,7 +494,7 @@ const mutations = mutationCache.findAll({ status: 'pending' }) getMutationDefaults(mutationKey: readonly unknown[]): OmitKeyof, "mutationKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1024) +Defined in: [packages/query-core/src/queryClient.ts:1027](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1027) Returns the default options registered for mutations whose mutation key partially matches the given `mutationKey`, via [QueryClient#setMutationDefaults](#setmutationdefaults). If multiple registered @@ -583,7 +583,7 @@ const data = queryClient.getQueriesData({ queryKey: ['posts'] }) getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -659,7 +659,7 @@ The cached data for the query, or `undefined` if no query with this key has been getQueryDefaults(queryKey: readonly unknown[]): OmitKeyof, "queryKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L964) +Defined in: [packages/query-core/src/queryClient.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L967) Returns the default options registered for queries whose query key partially matches the given `queryKey`, via [QueryClient#setQueryDefaults](#setquerydefaults). If multiple registered defaults @@ -753,7 +753,7 @@ console.log(state?.dataUpdatedAt) infiniteQuery, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryExecuteOptions): Promise[] ? InfiniteData : TData>; ``` -Defined in: [packages/query-core/src/queryClient.ts:720](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L720) +Defined in: [packages/query-core/src/queryClient.ts:723](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L723) Asynchronous method to fetch and cache an infinite query, resolving with an [InfiniteData](../interfaces/InfiniteData.md) object or throwing with the error. @@ -972,7 +972,7 @@ the shared listeners until the last one unmounts. prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:779](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L779) +Defined in: [packages/query-core/src/queryClient.ts:782](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L782) Fetches and caches an infinite query like [QueryClient#fetchInfiniteQuery](#fetchinfinitequery), but ignores the result and any error. @@ -1026,7 +1026,7 @@ Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.ca prefetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:684](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L684) +Defined in: [packages/query-core/src/queryClient.ts:687](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L687) Fetches and caches a query like [QueryClient#fetchQuery](#fetchquery), but ignores the result and any error. @@ -1076,7 +1076,7 @@ Use queryClient.query(options) instead. You can swallow errors with `.catch(noop query(options: QueryExecuteOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:593](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L593) +Defined in: [packages/query-core/src/queryClient.ts:596](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L596) Asynchronous method to fetch and cache a query, resolving with the data or throwing with the error. @@ -1159,15 +1159,18 @@ try { refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:533](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L533) +Defined in: [packages/query-core/src/queryClient.ts:537](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L537) Refetches queries matching the given filters, regardless of whether they are stale. Without filters, every query in the cache is refetched. Queries that are disabled, or static (only have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1189,13 +1192,14 @@ in the cache is included. [`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}` Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1300,7 +1304,7 @@ await queryClient.resetQueries({ queryKey: ['posts'], exact: true }) resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline. @@ -1328,7 +1332,7 @@ await queryClient.resumePausedMutations() setDefaultOptions(options: DefaultOptions): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L912) +Defined in: [packages/query-core/src/queryClient.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L915) Dynamically sets the default options for this client, overwriting any previously defined default options. @@ -1370,7 +1374,7 @@ queryClient.setDefaultOptions({ setMutationDefaults(mutationKey: readonly unknown[], options: OmitKeyof, "mutationKey">): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:994](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L994) +Defined in: [packages/query-core/src/queryClient.ts:997](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L997) Sets default options for mutations whose mutation key partially matches the given `mutationKey`. As with [QueryClient#setQueryDefaults](#setquerydefaults), the order of registration @@ -1572,7 +1576,7 @@ queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost]) setQueryDefaults(queryKey: readonly unknown[], options: Partial, "queryKey">>): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L932) +Defined in: [packages/query-core/src/queryClient.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L935) Sets default options for queries whose query key partially matches the given `queryKey`. diff --git a/docs/framework/lit/reference/classes/QueryClient.md b/docs/framework/lit/reference/classes/QueryClient.md index ec6790ab49..4082205221 100644 --- a/docs/framework/lit/reference/classes/QueryClient.md +++ b/docs/framework/lit/reference/classes/QueryClient.md @@ -104,7 +104,7 @@ await queryClient.cancelQueries({ queryKey: ['posts'], exact: true }) clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -129,7 +129,7 @@ queryClient.clear() defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -166,7 +166,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -223,7 +223,7 @@ The defaulted options, with `queryHash` and dependent defaults (e.g. ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -329,7 +329,7 @@ Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:751](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L751) +Defined in: [packages/query-core/src/queryClient.ts:754](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L754) Fetches and caches an infinite query, or returns its cached data if it isn't stale. @@ -383,7 +383,7 @@ Use queryClient.infiniteQuery(options) instead. This method will be removed in t fetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:645](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L645) +Defined in: [packages/query-core/src/queryClient.ts:648](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L648) Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers, the fetch isn't retried unless `retry` is set. @@ -438,7 +438,7 @@ Use queryClient.query(options) instead. This method will be removed in the next getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -466,7 +466,7 @@ const defaultOptions = queryClient.getDefaultOptions() getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -494,7 +494,7 @@ const mutations = mutationCache.findAll({ status: 'pending' }) getMutationDefaults(mutationKey: readonly unknown[]): OmitKeyof, "mutationKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1024) +Defined in: [packages/query-core/src/queryClient.ts:1027](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1027) Returns the default options registered for mutations whose mutation key partially matches the given `mutationKey`, via [QueryClient#setMutationDefaults](#setmutationdefaults). If multiple registered @@ -583,7 +583,7 @@ const data = queryClient.getQueriesData({ queryKey: ['posts'] }) getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -659,7 +659,7 @@ The cached data for the query, or `undefined` if no query with this key has been getQueryDefaults(queryKey: readonly unknown[]): OmitKeyof, "queryKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L964) +Defined in: [packages/query-core/src/queryClient.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L967) Returns the default options registered for queries whose query key partially matches the given `queryKey`, via [QueryClient#setQueryDefaults](#setquerydefaults). If multiple registered defaults @@ -753,7 +753,7 @@ console.log(state?.dataUpdatedAt) infiniteQuery, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryExecuteOptions): Promise[] ? InfiniteData : TData>; ``` -Defined in: [packages/query-core/src/queryClient.ts:720](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L720) +Defined in: [packages/query-core/src/queryClient.ts:723](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L723) Asynchronous method to fetch and cache an infinite query, resolving with an [InfiniteData](../interfaces/InfiniteData.md) object or throwing with the error. @@ -972,7 +972,7 @@ the shared listeners until the last one unmounts. prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:779](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L779) +Defined in: [packages/query-core/src/queryClient.ts:782](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L782) Fetches and caches an infinite query like [QueryClient#fetchInfiniteQuery](#fetchinfinitequery), but ignores the result and any error. @@ -1026,7 +1026,7 @@ Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.ca prefetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:684](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L684) +Defined in: [packages/query-core/src/queryClient.ts:687](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L687) Fetches and caches a query like [QueryClient#fetchQuery](#fetchquery), but ignores the result and any error. @@ -1076,7 +1076,7 @@ Use queryClient.query(options) instead. You can swallow errors with `.catch(noop query(options: QueryExecuteOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:593](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L593) +Defined in: [packages/query-core/src/queryClient.ts:596](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L596) Asynchronous method to fetch and cache a query, resolving with the data or throwing with the error. @@ -1159,15 +1159,18 @@ try { refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:533](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L533) +Defined in: [packages/query-core/src/queryClient.ts:537](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L537) Refetches queries matching the given filters, regardless of whether they are stale. Without filters, every query in the cache is refetched. Queries that are disabled, or static (only have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1189,13 +1192,14 @@ in the cache is included. [`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}` Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1300,7 +1304,7 @@ await queryClient.resetQueries({ queryKey: ['posts'], exact: true }) resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline. @@ -1328,7 +1332,7 @@ await queryClient.resumePausedMutations() setDefaultOptions(options: DefaultOptions): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L912) +Defined in: [packages/query-core/src/queryClient.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L915) Dynamically sets the default options for this client, overwriting any previously defined default options. @@ -1370,7 +1374,7 @@ queryClient.setDefaultOptions({ setMutationDefaults(mutationKey: readonly unknown[], options: OmitKeyof, "mutationKey">): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:994](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L994) +Defined in: [packages/query-core/src/queryClient.ts:997](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L997) Sets default options for mutations whose mutation key partially matches the given `mutationKey`. As with [QueryClient#setQueryDefaults](#setquerydefaults), the order of registration @@ -1572,7 +1576,7 @@ queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost]) setQueryDefaults(queryKey: readonly unknown[], options: Partial, "queryKey">>): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L932) +Defined in: [packages/query-core/src/queryClient.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L935) Sets default options for queries whose query key partially matches the given `queryKey`. diff --git a/docs/framework/preact/reference/classes/QueryClient.md b/docs/framework/preact/reference/classes/QueryClient.md index 4863483a0c..5ad37c2463 100644 --- a/docs/framework/preact/reference/classes/QueryClient.md +++ b/docs/framework/preact/reference/classes/QueryClient.md @@ -104,7 +104,7 @@ await queryClient.cancelQueries({ queryKey: ['posts'], exact: true }) clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -129,7 +129,7 @@ queryClient.clear() defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -166,7 +166,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -223,7 +223,7 @@ The defaulted options, with `queryHash` and dependent defaults (e.g. ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -329,7 +329,7 @@ Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:751](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L751) +Defined in: [packages/query-core/src/queryClient.ts:754](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L754) Fetches and caches an infinite query, or returns its cached data if it isn't stale. @@ -383,7 +383,7 @@ Use queryClient.infiniteQuery(options) instead. This method will be removed in t fetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:645](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L645) +Defined in: [packages/query-core/src/queryClient.ts:648](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L648) Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers, the fetch isn't retried unless `retry` is set. @@ -438,7 +438,7 @@ Use queryClient.query(options) instead. This method will be removed in the next getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -466,7 +466,7 @@ const defaultOptions = queryClient.getDefaultOptions() getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -494,7 +494,7 @@ const mutations = mutationCache.findAll({ status: 'pending' }) getMutationDefaults(mutationKey: readonly unknown[]): OmitKeyof, "mutationKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1024) +Defined in: [packages/query-core/src/queryClient.ts:1027](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1027) Returns the default options registered for mutations whose mutation key partially matches the given `mutationKey`, via [QueryClient#setMutationDefaults](#setmutationdefaults). If multiple registered @@ -583,7 +583,7 @@ const data = queryClient.getQueriesData({ queryKey: ['posts'] }) getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -659,7 +659,7 @@ The cached data for the query, or `undefined` if no query with this key has been getQueryDefaults(queryKey: readonly unknown[]): OmitKeyof, "queryKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L964) +Defined in: [packages/query-core/src/queryClient.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L967) Returns the default options registered for queries whose query key partially matches the given `queryKey`, via [QueryClient#setQueryDefaults](#setquerydefaults). If multiple registered defaults @@ -753,7 +753,7 @@ console.log(state?.dataUpdatedAt) infiniteQuery, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryExecuteOptions): Promise[] ? InfiniteData : TData>; ``` -Defined in: [packages/query-core/src/queryClient.ts:720](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L720) +Defined in: [packages/query-core/src/queryClient.ts:723](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L723) Asynchronous method to fetch and cache an infinite query, resolving with an [InfiniteData](../interfaces/InfiniteData.md) object or throwing with the error. @@ -972,7 +972,7 @@ the shared listeners until the last one unmounts. prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:779](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L779) +Defined in: [packages/query-core/src/queryClient.ts:782](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L782) Fetches and caches an infinite query like [QueryClient#fetchInfiniteQuery](#fetchinfinitequery), but ignores the result and any error. @@ -1026,7 +1026,7 @@ Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.ca prefetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:684](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L684) +Defined in: [packages/query-core/src/queryClient.ts:687](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L687) Fetches and caches a query like [QueryClient#fetchQuery](#fetchquery), but ignores the result and any error. @@ -1076,7 +1076,7 @@ Use queryClient.query(options) instead. You can swallow errors with `.catch(noop query(options: QueryExecuteOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:593](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L593) +Defined in: [packages/query-core/src/queryClient.ts:596](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L596) Asynchronous method to fetch and cache a query, resolving with the data or throwing with the error. @@ -1159,15 +1159,18 @@ try { refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:533](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L533) +Defined in: [packages/query-core/src/queryClient.ts:537](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L537) Refetches queries matching the given filters, regardless of whether they are stale. Without filters, every query in the cache is refetched. Queries that are disabled, or static (only have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1189,13 +1192,14 @@ in the cache is included. [`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}` Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1300,7 +1304,7 @@ await queryClient.resetQueries({ queryKey: ['posts'], exact: true }) resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline. @@ -1328,7 +1332,7 @@ await queryClient.resumePausedMutations() setDefaultOptions(options: DefaultOptions): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L912) +Defined in: [packages/query-core/src/queryClient.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L915) Dynamically sets the default options for this client, overwriting any previously defined default options. @@ -1370,7 +1374,7 @@ queryClient.setDefaultOptions({ setMutationDefaults(mutationKey: readonly unknown[], options: OmitKeyof, "mutationKey">): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:994](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L994) +Defined in: [packages/query-core/src/queryClient.ts:997](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L997) Sets default options for mutations whose mutation key partially matches the given `mutationKey`. As with [QueryClient#setQueryDefaults](#setquerydefaults), the order of registration @@ -1572,7 +1576,7 @@ queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost]) setQueryDefaults(queryKey: readonly unknown[], options: Partial, "queryKey">>): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L932) +Defined in: [packages/query-core/src/queryClient.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L935) Sets default options for queries whose query key partially matches the given `queryKey`. diff --git a/docs/framework/react/reference/classes/QueryClient.md b/docs/framework/react/reference/classes/QueryClient.md index 05bbaa2c23..215379a99f 100644 --- a/docs/framework/react/reference/classes/QueryClient.md +++ b/docs/framework/react/reference/classes/QueryClient.md @@ -107,7 +107,7 @@ await queryClient.cancelQueries({ queryKey: ['posts'], exact: true }) clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -132,7 +132,7 @@ queryClient.clear() defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -169,7 +169,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -226,7 +226,7 @@ The defaulted options, with `queryHash` and dependent defaults (e.g. ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -332,7 +332,7 @@ Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:751](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L751) +Defined in: [packages/query-core/src/queryClient.ts:754](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L754) Fetches and caches an infinite query, or returns its cached data if it isn't stale. @@ -386,7 +386,7 @@ Use queryClient.infiniteQuery(options) instead. This method will be removed in t fetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:645](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L645) +Defined in: [packages/query-core/src/queryClient.ts:648](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L648) Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers, the fetch isn't retried unless `retry` is set. @@ -441,7 +441,7 @@ Use queryClient.query(options) instead. This method will be removed in the next getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -469,7 +469,7 @@ const defaultOptions = queryClient.getDefaultOptions() getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -497,7 +497,7 @@ const mutations = mutationCache.findAll({ status: 'pending' }) getMutationDefaults(mutationKey: readonly unknown[]): OmitKeyof, "mutationKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1024) +Defined in: [packages/query-core/src/queryClient.ts:1027](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1027) Returns the default options registered for mutations whose mutation key partially matches the given `mutationKey`, via [QueryClient#setMutationDefaults](#setmutationdefaults). If multiple registered @@ -586,7 +586,7 @@ const data = queryClient.getQueriesData({ queryKey: ['posts'] }) getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -662,7 +662,7 @@ The cached data for the query, or `undefined` if no query with this key has been getQueryDefaults(queryKey: readonly unknown[]): OmitKeyof, "queryKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L964) +Defined in: [packages/query-core/src/queryClient.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L967) Returns the default options registered for queries whose query key partially matches the given `queryKey`, via [QueryClient#setQueryDefaults](#setquerydefaults). If multiple registered defaults @@ -756,7 +756,7 @@ console.log(state?.dataUpdatedAt) infiniteQuery, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryExecuteOptions): Promise[] ? InfiniteData : TData>; ``` -Defined in: [packages/query-core/src/queryClient.ts:720](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L720) +Defined in: [packages/query-core/src/queryClient.ts:723](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L723) Asynchronous method to fetch and cache an infinite query, resolving with an [InfiniteData](../interfaces/InfiniteData.md) object or throwing with the error. @@ -975,7 +975,7 @@ the shared listeners until the last one unmounts. prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:779](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L779) +Defined in: [packages/query-core/src/queryClient.ts:782](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L782) Fetches and caches an infinite query like [QueryClient#fetchInfiniteQuery](#fetchinfinitequery), but ignores the result and any error. @@ -1029,7 +1029,7 @@ Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.ca prefetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:684](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L684) +Defined in: [packages/query-core/src/queryClient.ts:687](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L687) Fetches and caches a query like [QueryClient#fetchQuery](#fetchquery), but ignores the result and any error. @@ -1079,7 +1079,7 @@ Use queryClient.query(options) instead. You can swallow errors with `.catch(noop query(options: QueryExecuteOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:593](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L593) +Defined in: [packages/query-core/src/queryClient.ts:596](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L596) Asynchronous method to fetch and cache a query, resolving with the data or throwing with the error. @@ -1162,15 +1162,18 @@ try { refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:533](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L533) +Defined in: [packages/query-core/src/queryClient.ts:537](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L537) Refetches queries matching the given filters, regardless of whether they are stale. Without filters, every query in the cache is refetched. Queries that are disabled, or static (only have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1192,13 +1195,14 @@ in the cache is included. [`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}` Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1303,7 +1307,7 @@ await queryClient.resetQueries({ queryKey: ['posts'], exact: true }) resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline. @@ -1331,7 +1335,7 @@ await queryClient.resumePausedMutations() setDefaultOptions(options: DefaultOptions): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L912) +Defined in: [packages/query-core/src/queryClient.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L915) Dynamically sets the default options for this client, overwriting any previously defined default options. @@ -1373,7 +1377,7 @@ queryClient.setDefaultOptions({ setMutationDefaults(mutationKey: readonly unknown[], options: OmitKeyof, "mutationKey">): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:994](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L994) +Defined in: [packages/query-core/src/queryClient.ts:997](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L997) Sets default options for mutations whose mutation key partially matches the given `mutationKey`. As with [QueryClient#setQueryDefaults](#setquerydefaults), the order of registration @@ -1575,7 +1579,7 @@ queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost]) setQueryDefaults(queryKey: readonly unknown[], options: Partial, "queryKey">>): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L932) +Defined in: [packages/query-core/src/queryClient.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L935) Sets default options for queries whose query key partially matches the given `queryKey`. diff --git a/docs/framework/solid/reference/classes/QueryClient.md b/docs/framework/solid/reference/classes/QueryClient.md index 470ad707ef..67e8ce17de 100644 --- a/docs/framework/solid/reference/classes/QueryClient.md +++ b/docs/framework/solid/reference/classes/QueryClient.md @@ -105,7 +105,7 @@ QueryCoreClient.cancelQueries clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -136,7 +136,7 @@ QueryCoreClient.clear defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -179,7 +179,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -242,7 +242,7 @@ QueryCoreClient.defaultQueryOptions ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -360,7 +360,7 @@ QueryCoreClient.ensureQueryData fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:751](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L751) +Defined in: [packages/query-core/src/queryClient.ts:754](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L754) Fetches and caches an infinite query, or returns its cached data if it isn't stale. @@ -420,7 +420,7 @@ QueryCoreClient.fetchInfiniteQuery fetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:645](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L645) +Defined in: [packages/query-core/src/queryClient.ts:648](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L648) Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers, the fetch isn't retried unless `retry` is set. @@ -481,7 +481,7 @@ QueryCoreClient.fetchQuery getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -515,7 +515,7 @@ QueryCoreClient.getDefaultOptions getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -549,7 +549,7 @@ QueryCoreClient.getMutationCache getMutationDefaults(mutationKey: readonly unknown[]): OmitKeyof, "mutationKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1024) +Defined in: [packages/query-core/src/queryClient.ts:1027](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1027) Returns the default options registered for mutations whose mutation key partially matches the given `mutationKey`, via [QueryClient#setMutationDefaults](#setmutationdefaults). If multiple registered @@ -650,7 +650,7 @@ QueryCoreClient.getQueriesData getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -738,7 +738,7 @@ QueryCoreClient.getQueryData getQueryDefaults(queryKey: readonly unknown[]): OmitKeyof, "queryKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L964) +Defined in: [packages/query-core/src/queryClient.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L967) Returns the default options registered for queries whose query key partially matches the given `queryKey`, via [QueryClient#setQueryDefaults](#setquerydefaults). If multiple registered defaults @@ -844,7 +844,7 @@ QueryCoreClient.getQueryState infiniteQuery, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryExecuteOptions): Promise[] ? InfiniteData : TData>; ``` -Defined in: [packages/query-core/src/queryClient.ts:720](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L720) +Defined in: [packages/query-core/src/queryClient.ts:723](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L723) Asynchronous method to fetch and cache an infinite query, resolving with an [InfiniteData](../interfaces/InfiniteData.md) object or throwing with the error. @@ -1093,7 +1093,7 @@ QueryCoreClient.mount prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:779](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L779) +Defined in: [packages/query-core/src/queryClient.ts:782](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L782) Fetches and caches an infinite query like [QueryClient#fetchInfiniteQuery](#fetchinfinitequery), but ignores the result and any error. @@ -1153,7 +1153,7 @@ QueryCoreClient.prefetchInfiniteQuery prefetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:684](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L684) +Defined in: [packages/query-core/src/queryClient.ts:687](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L687) Fetches and caches a query like [QueryClient#fetchQuery](#fetchquery), but ignores the result and any error. @@ -1209,7 +1209,7 @@ QueryCoreClient.prefetchQuery query(options: QueryExecuteOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:593](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L593) +Defined in: [packages/query-core/src/queryClient.ts:596](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L596) Asynchronous method to fetch and cache a query, resolving with the data or throwing with the error. @@ -1298,15 +1298,18 @@ QueryCoreClient.query refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:533](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L533) +Defined in: [packages/query-core/src/queryClient.ts:537](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L537) Refetches queries matching the given filters, regardless of whether they are stale. Without filters, every query in the cache is refetched. Queries that are disabled, or static (only have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1328,13 +1331,14 @@ in the cache is included. [`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}` Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1457,7 +1461,7 @@ QueryCoreClient.resetQueries resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline. @@ -1491,7 +1495,7 @@ QueryCoreClient.resumePausedMutations setDefaultOptions(options: DefaultOptions): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L912) +Defined in: [packages/query-core/src/queryClient.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L915) Dynamically sets the default options for this client, overwriting any previously defined default options. @@ -1539,7 +1543,7 @@ QueryCoreClient.setDefaultOptions setMutationDefaults(mutationKey: readonly unknown[], options: OmitKeyof, "mutationKey">): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:994](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L994) +Defined in: [packages/query-core/src/queryClient.ts:997](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L997) Sets default options for mutations whose mutation key partially matches the given `mutationKey`. As with [QueryClient#setQueryDefaults](#setquerydefaults), the order of registration @@ -1759,7 +1763,7 @@ QueryCoreClient.setQueryData setQueryDefaults(queryKey: readonly unknown[], options: Partial, "queryKey">>): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L932) +Defined in: [packages/query-core/src/queryClient.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L935) Sets default options for queries whose query key partially matches the given `queryKey`. diff --git a/docs/framework/svelte/reference/classes/QueryClient.md b/docs/framework/svelte/reference/classes/QueryClient.md index 4863483a0c..5ad37c2463 100644 --- a/docs/framework/svelte/reference/classes/QueryClient.md +++ b/docs/framework/svelte/reference/classes/QueryClient.md @@ -104,7 +104,7 @@ await queryClient.cancelQueries({ queryKey: ['posts'], exact: true }) clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -129,7 +129,7 @@ queryClient.clear() defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -166,7 +166,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -223,7 +223,7 @@ The defaulted options, with `queryHash` and dependent defaults (e.g. ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -329,7 +329,7 @@ Use queryClient.query({ ...options, staleTime: 'static' }) instead. This method fetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:751](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L751) +Defined in: [packages/query-core/src/queryClient.ts:754](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L754) Fetches and caches an infinite query, or returns its cached data if it isn't stale. @@ -383,7 +383,7 @@ Use queryClient.infiniteQuery(options) instead. This method will be removed in t fetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:645](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L645) +Defined in: [packages/query-core/src/queryClient.ts:648](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L648) Fetches and caches a query, or returns its cached data if it isn't stale. Unlike in observers, the fetch isn't retried unless `retry` is set. @@ -438,7 +438,7 @@ Use queryClient.query(options) instead. This method will be removed in the next getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -466,7 +466,7 @@ const defaultOptions = queryClient.getDefaultOptions() getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -494,7 +494,7 @@ const mutations = mutationCache.findAll({ status: 'pending' }) getMutationDefaults(mutationKey: readonly unknown[]): OmitKeyof, "mutationKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1024) +Defined in: [packages/query-core/src/queryClient.ts:1027](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1027) Returns the default options registered for mutations whose mutation key partially matches the given `mutationKey`, via [QueryClient#setMutationDefaults](#setmutationdefaults). If multiple registered @@ -583,7 +583,7 @@ const data = queryClient.getQueriesData({ queryKey: ['posts'] }) getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -659,7 +659,7 @@ The cached data for the query, or `undefined` if no query with this key has been getQueryDefaults(queryKey: readonly unknown[]): OmitKeyof, "queryKey">; ``` -Defined in: [packages/query-core/src/queryClient.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L964) +Defined in: [packages/query-core/src/queryClient.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L967) Returns the default options registered for queries whose query key partially matches the given `queryKey`, via [QueryClient#setQueryDefaults](#setquerydefaults). If multiple registered defaults @@ -753,7 +753,7 @@ console.log(state?.dataUpdatedAt) infiniteQuery, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryExecuteOptions): Promise[] ? InfiniteData : TData>; ``` -Defined in: [packages/query-core/src/queryClient.ts:720](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L720) +Defined in: [packages/query-core/src/queryClient.ts:723](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L723) Asynchronous method to fetch and cache an infinite query, resolving with an [InfiniteData](../interfaces/InfiniteData.md) object or throwing with the error. @@ -972,7 +972,7 @@ the shared listeners until the last one unmounts. prefetchInfiniteQuery(options: FetchInfiniteQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:779](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L779) +Defined in: [packages/query-core/src/queryClient.ts:782](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L782) Fetches and caches an infinite query like [QueryClient#fetchInfiniteQuery](#fetchinfinitequery), but ignores the result and any error. @@ -1026,7 +1026,7 @@ Use queryClient.infiniteQuery(options) instead. You can swallow errors with `.ca prefetchQuery(options: FetchQueryOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:684](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L684) +Defined in: [packages/query-core/src/queryClient.ts:687](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L687) Fetches and caches a query like [QueryClient#fetchQuery](#fetchquery), but ignores the result and any error. @@ -1076,7 +1076,7 @@ Use queryClient.query(options) instead. You can swallow errors with `.catch(noop query(options: QueryExecuteOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:593](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L593) +Defined in: [packages/query-core/src/queryClient.ts:596](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L596) Asynchronous method to fetch and cache a query, resolving with the data or throwing with the error. @@ -1159,15 +1159,18 @@ try { refetchQueries(filters?: RefetchQueryFilters, options?: RefetchOptions): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:533](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L533) +Defined in: [packages/query-core/src/queryClient.ts:537](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L537) Refetches queries matching the given filters, regardless of whether they are stale. Without filters, every query in the cache is refetched. Queries that are disabled, or static (only have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1189,13 +1192,14 @@ in the cache is included. [`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}` Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1300,7 +1304,7 @@ await queryClient.resetQueries({ queryKey: ['posts'], exact: true }) resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline. @@ -1328,7 +1332,7 @@ await queryClient.resumePausedMutations() setDefaultOptions(options: DefaultOptions): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L912) +Defined in: [packages/query-core/src/queryClient.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L915) Dynamically sets the default options for this client, overwriting any previously defined default options. @@ -1370,7 +1374,7 @@ queryClient.setDefaultOptions({ setMutationDefaults(mutationKey: readonly unknown[], options: OmitKeyof, "mutationKey">): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:994](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L994) +Defined in: [packages/query-core/src/queryClient.ts:997](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L997) Sets default options for mutations whose mutation key partially matches the given `mutationKey`. As with [QueryClient#setQueryDefaults](#setquerydefaults), the order of registration @@ -1572,7 +1576,7 @@ queryClient.setQueryData(['posts'], (oldPosts) => [...oldPosts, newPost]) setQueryDefaults(queryKey: readonly unknown[], options: Partial, "queryKey">>): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L932) +Defined in: [packages/query-core/src/queryClient.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L935) Sets default options for queries whose query key partially matches the given `queryKey`. diff --git a/docs/framework/vue/reference/classes/QueryClient.md b/docs/framework/vue/reference/classes/QueryClient.md index 883c769589..34ae9b2d76 100644 --- a/docs/framework/vue/reference/classes/QueryClient.md +++ b/docs/framework/vue/reference/classes/QueryClient.md @@ -125,7 +125,7 @@ QC.cancelQueries clear(): void; ``` -Defined in: [packages/query-core/src/queryClient.ts:1166](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1166) +Defined in: [packages/query-core/src/queryClient.ts:1169](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1169) Clears both the query cache and the mutation cache this client is connected to. @@ -156,7 +156,7 @@ QC.clear defaultMutationOptions>(options?: T): T; ``` -Defined in: [packages/query-core/src/queryClient.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1141) +Defined in: [packages/query-core/src/queryClient.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1144) The mutation counterpart of [QueryClient#defaultQueryOptions](#defaultqueryoptions). Called by framework adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then @@ -199,7 +199,7 @@ defaultQueryOptions): DefaultedQueryObserverOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1052) +Defined in: [packages/query-core/src/queryClient.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L1055) Called by framework adapters (e.g. inside `useQuery`) to resolve the options passed by the caller into their final, defaulted form: merging the client's own `defaultOptions.queries`, @@ -262,7 +262,7 @@ QC.defaultQueryOptions ensureInfiniteQueryData(options: EnsureInfiniteQueryDataOptions): Promise>; ``` -Defined in: [packages/query-core/src/queryClient.ts:807](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L807) +Defined in: [packages/query-core/src/queryClient.ts:810](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L810) Returns the cached data of an infinite query, or fetches it if there is none. With `revalidateIfStale`, stale cached data is also refetched in the background. @@ -682,7 +682,7 @@ QC.fetchQuery getDefaultOptions(): DefaultOptions; ``` -Defined in: [packages/query-core/src/queryClient.ts:891](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L891) +Defined in: [packages/query-core/src/queryClient.ts:894](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L894) Returns the default options that were set when creating the client, or via [QueryClient#setDefaultOptions](#setdefaultoptions). @@ -716,7 +716,7 @@ QC.getDefaultOptions getMutationCache(): MutationCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:875](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L875) +Defined in: [packages/query-core/src/queryClient.ts:878](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L878) Returns the mutation cache this client is connected to. @@ -847,7 +847,7 @@ QC.getQueriesData getQueryCache(): QueryCache; ``` -Defined in: [packages/query-core/src/queryClient.ts:859](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L859) +Defined in: [packages/query-core/src/queryClient.ts:862](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L862) Returns the query cache this client is connected to. @@ -1838,8 +1838,11 @@ filters, every query in the cache is refetched. Queries that are disabled, or st have observers with a static `staleTime`), are never refetched. By default (`cancelRefetch: true`), a currently running fetch is cancelled before the new -one starts. The returned promise resolves once all matching queries have settled; it does -not reject on individual query failures unless `throwOnError` is set. +one starts. The returned promise does not reject on individual query failures unless +`throwOnError` is `true`. + +Initially paused fetches do not delay the returned promise. Their later errors are handled +even when `throwOnError` is `true`. #### Type Parameters @@ -1861,13 +1864,14 @@ in the cache is included. `MaybeRefDeep`\<[`RefetchOptions`](../interfaces/RefetchOptions.md)\> Set `cancelRefetch` to `false` to keep a running fetch instead of cancelling -it, and `throwOnError` to `true` to reject when a refetch fails. +it, and `throwOnError` to `true` to reject when a refetch that was not initially paused fails. #### Returns `Promise`\<`void`\> -A promise that resolves once every matched query has settled. +A promise that resolves once all matching refetches that were not initially paused +have settled. #### Example @@ -1990,7 +1994,7 @@ QC.resetQueries resumePausedMutations(): Promise; ``` -Defined in: [packages/query-core/src/queryClient.ts:840](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L840) +Defined in: [packages/query-core/src/queryClient.ts:843](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryClient.ts#L843) Resumes mutations that were paused because there was no network connection. Does nothing (resolving immediately) if the client is currently offline.