snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
26
docs/framework/lit/reference/interfaces/CancelOptions.md
Normal file
26
docs/framework/lit/reference/interfaces/CancelOptions.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
id: CancelOptions
|
||||
title: CancelOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1521](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1521)
|
||||
|
||||
## Properties
|
||||
|
||||
### revert?
|
||||
|
||||
```ts
|
||||
optional revert: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1522](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1522)
|
||||
|
||||
***
|
||||
|
||||
### silent?
|
||||
|
||||
```ts
|
||||
optional silent: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1523](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1523)
|
||||
84
docs/framework/lit/reference/interfaces/DefaultOptions.md
Normal file
84
docs/framework/lit/reference/interfaces/DefaultOptions.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
id: DefaultOptions
|
||||
title: DefaultOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1507](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1507)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### dehydrate?
|
||||
|
||||
```ts
|
||||
optional dehydrate: DehydrateOptions;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1518](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1518)
|
||||
|
||||
Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md).
|
||||
|
||||
***
|
||||
|
||||
### hydrate?
|
||||
|
||||
```ts
|
||||
optional hydrate: object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1516](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1516)
|
||||
|
||||
Default options used when hydrating queries; see [HydrateOptions](HydrateOptions.md).
|
||||
|
||||
#### deserializeData?
|
||||
|
||||
```ts
|
||||
optional deserializeData: TransformerFn;
|
||||
```
|
||||
|
||||
Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`.
|
||||
|
||||
#### mutations?
|
||||
|
||||
```ts
|
||||
optional mutations: MutationOptions<unknown, Error, unknown, unknown>;
|
||||
```
|
||||
|
||||
Default options merged into every mutation restored from the dehydrated state.
|
||||
|
||||
#### queries?
|
||||
|
||||
```ts
|
||||
optional queries: QueryOptions<unknown, Error, unknown, readonly unknown[], never>;
|
||||
```
|
||||
|
||||
Default options merged into every query restored from the dehydrated state.
|
||||
|
||||
***
|
||||
|
||||
### mutations?
|
||||
|
||||
```ts
|
||||
optional mutations: MutationObserverOptions<unknown, TError, unknown, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1514](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1514)
|
||||
|
||||
Default options applied to every mutation, unless overridden per-mutation.
|
||||
|
||||
***
|
||||
|
||||
### queries?
|
||||
|
||||
```ts
|
||||
optional queries: OmitKeyof<QueryObserverOptions<unknown, TError, unknown, unknown, readonly unknown[], never>, "queryKey" | "suspense", "strictly">;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1509](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1509)
|
||||
|
||||
Default options applied to every query, unless overridden per-query.
|
||||
89
docs/framework/lit/reference/interfaces/DehydrateOptions.md
Normal file
89
docs/framework/lit/reference/interfaces/DehydrateOptions.md
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
id: DehydrateOptions
|
||||
title: DehydrateOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:42](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L42)
|
||||
|
||||
Options for `dehydrate`, controlling which queries/mutations are included in the resulting `DehydratedState` and
|
||||
how their data/errors are transformed before being serialized (e.g. for embedding in server-rendered markup).
|
||||
|
||||
## Properties
|
||||
|
||||
### serializeData?
|
||||
|
||||
```ts
|
||||
optional serializeData: TransformerFn;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:44](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L44)
|
||||
|
||||
Transforms a query's `data` before it is dehydrated. Useful for non-JSON-serializable data.
|
||||
|
||||
***
|
||||
|
||||
### shouldDehydrateMutation()?
|
||||
|
||||
```ts
|
||||
optional shouldDehydrateMutation: (mutation) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:46](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L46)
|
||||
|
||||
Predicate to decide whether a given `Mutation` should be dehydrated. Defaults to `defaultShouldDehydrateMutation`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### shouldDehydrateQuery()?
|
||||
|
||||
```ts
|
||||
optional shouldDehydrateQuery: (query) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:48](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L48)
|
||||
|
||||
Predicate to decide whether a given `Query` should be dehydrated. Defaults to `defaultShouldDehydrateQuery`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### shouldRedactErrors()?
|
||||
|
||||
```ts
|
||||
optional shouldRedactErrors: (error) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:54](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L54)
|
||||
|
||||
Predicate to decide whether a query's error should be redacted before dehydration. Errors are redacted
|
||||
(replaced with a generic `Error('redacted')`) unless this function is provided and returns `false` for the
|
||||
given error, in which case the original error is kept.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### error
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
30
docs/framework/lit/reference/interfaces/DehydratedState.md
Normal file
30
docs/framework/lit/reference/interfaces/DehydratedState.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
id: DehydratedState
|
||||
title: DehydratedState
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:94](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L94)
|
||||
|
||||
A serializable snapshot of a `QueryClient`'s cache, as produced by `dehydrate` and consumed by `hydrate`. Typically
|
||||
transported from server to client (e.g. embedded in server-rendered markup) to seed the client's cache with data
|
||||
that has already been fetched, avoiding a redundant fetch on the client.
|
||||
|
||||
## Properties
|
||||
|
||||
### mutations
|
||||
|
||||
```ts
|
||||
mutations: DehydratedMutation[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:95](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L95)
|
||||
|
||||
***
|
||||
|
||||
### queries
|
||||
|
||||
```ts
|
||||
queries: DehydratedQuery[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:96](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L96)
|
||||
@@ -0,0 +1,350 @@
|
||||
---
|
||||
id: EnsureQueryDataOptions
|
||||
title: EnsureQueryDataOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:614](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L614)
|
||||
|
||||
## Deprecated
|
||||
|
||||
## Extends
|
||||
|
||||
- [`FetchQueryOptions`](FetchQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `never`
|
||||
|
||||
## Properties
|
||||
|
||||
### ~~gcTime?~~
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L277)
|
||||
|
||||
The time in milliseconds that unused/inactive cache data remains in memory.
|
||||
When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.
|
||||
When different garbage collection times are specified, the longest one will be used.
|
||||
Setting it to `Infinity` will disable garbage collection.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
Note: the maximum allowed time is about 24 days, imposed by `setTimeout`'s 32-bit signed integer delay — see
|
||||
`timeoutManager.setTimeoutProvider` for a workaround.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`gcTime`](FetchQueryOptions.md#gctime)
|
||||
|
||||
***
|
||||
|
||||
### ~~initialData?~~
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| TData
|
||||
| InitialDataFunction<TData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:317](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L317)
|
||||
|
||||
If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
||||
created or cached yet).
|
||||
If set to a function, the function will be called **once** during the shared/root query initialization, and be
|
||||
expected to synchronously return the initial data.
|
||||
Initial data is considered stale by default unless a `staleTime` has been set.
|
||||
`initialData` **is persisted** to the cache.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`initialData`](FetchQueryOptions.md#initialdata)
|
||||
|
||||
***
|
||||
|
||||
### ~~initialDataUpdatedAt?~~
|
||||
|
||||
```ts
|
||||
optional initialDataUpdatedAt: number | () => number | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L321)
|
||||
|
||||
If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`initialDataUpdatedAt`](FetchQueryOptions.md#initialdataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### ~~initialPageParam?~~
|
||||
|
||||
```ts
|
||||
optional initialPageParam: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:605](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L605)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`initialPageParam`](FetchQueryOptions.md#initialpageparam)
|
||||
|
||||
***
|
||||
|
||||
### ~~maxPages?~~
|
||||
|
||||
```ts
|
||||
optional maxPages: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:345](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L345)
|
||||
|
||||
Maximum number of pages to store in the data of an infinite query.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`maxPages`](FetchQueryOptions.md#maxpages)
|
||||
|
||||
***
|
||||
|
||||
### ~~meta?~~
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:341](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L341)
|
||||
|
||||
Additional payload to be stored on each query.
|
||||
Use this property to pass information that can be used in other places.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`meta`](FetchQueryOptions.md#meta)
|
||||
|
||||
***
|
||||
|
||||
### ~~networkMode?~~
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:265](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L265)
|
||||
|
||||
Controls whether a query is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`networkMode`](FetchQueryOptions.md#networkmode)
|
||||
|
||||
***
|
||||
|
||||
### ~~persister?~~
|
||||
|
||||
```ts
|
||||
optional persister: QueryPersister<TQueryFnData, NoInfer<TQueryKey>, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L290)
|
||||
|
||||
This option can be used to persist the result of a query to an external storage, bypassing the need to actually
|
||||
call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`persister`](FetchQueryOptions.md#persister)
|
||||
|
||||
***
|
||||
|
||||
### ~~queryFn?~~
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:285](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L285)
|
||||
|
||||
The function that the query will use to request data.
|
||||
Required, unless a default query function has been set via `queryClient.setQueryDefaults` or
|
||||
`queryClient.setDefaultOptions`.
|
||||
Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md).
|
||||
Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`queryFn`](FetchQueryOptions.md#queryfn)
|
||||
|
||||
***
|
||||
|
||||
### ~~queryHash?~~
|
||||
|
||||
```ts
|
||||
optional queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:295](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L295)
|
||||
|
||||
The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used
|
||||
as the actual cache key internally.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`queryHash`](FetchQueryOptions.md#queryhash)
|
||||
|
||||
***
|
||||
|
||||
### ~~queryKey~~
|
||||
|
||||
```ts
|
||||
queryKey: TQueryKey & object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:304](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L304)
|
||||
|
||||
The query key to use for this query.
|
||||
|
||||
The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys)
|
||||
for more information.
|
||||
|
||||
The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`queryKey`](FetchQueryOptions.md#querykey)
|
||||
|
||||
***
|
||||
|
||||
### ~~queryKeyHashFn?~~
|
||||
|
||||
```ts
|
||||
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L308)
|
||||
|
||||
If specified, this function is used to hash the `queryKey` to a string.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`queryKeyHashFn`](FetchQueryOptions.md#querykeyhashfn)
|
||||
|
||||
***
|
||||
|
||||
### ~~retry?~~
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L246)
|
||||
|
||||
If `false`, failed queries will not retry by default.
|
||||
If `true`, failed queries will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
|
||||
|
||||
Defaults to `3` on the client and `0` on the server.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`retry`](FetchQueryOptions.md#retry)
|
||||
|
||||
***
|
||||
|
||||
### ~~retryDelay?~~
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:258](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L258)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential
|
||||
backoff.
|
||||
|
||||
A function like `attempt => attempt * 1000` applies linear backoff.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`retryDelay`](FetchQueryOptions.md#retrydelay)
|
||||
|
||||
***
|
||||
|
||||
### ~~revalidateIfStale?~~
|
||||
|
||||
```ts
|
||||
optional revalidateIfStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:627](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L627)
|
||||
|
||||
***
|
||||
|
||||
### ~~staleTime?~~
|
||||
|
||||
```ts
|
||||
optional staleTime: StaleTimeFunction<TQueryFnData, TError, TData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:610](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L610)
|
||||
|
||||
The time in milliseconds after data is considered stale.
|
||||
If the data is fresh it will be returned from the cache.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`staleTime`](FetchQueryOptions.md#staletime)
|
||||
|
||||
***
|
||||
|
||||
### ~~structuralSharing?~~
|
||||
|
||||
```ts
|
||||
optional structuralSharing: boolean | (oldData, newData) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330)
|
||||
|
||||
Set this to `false` to disable structural sharing between query results.
|
||||
Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`FetchQueryOptions`](FetchQueryOptions.md).[`structuralSharing`](FetchQueryOptions.md#structuralsharing)
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: FetchNextPageOptions
|
||||
title: FetchNextPageOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:737](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L737)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`ResultOptions`](ResultOptions.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### cancelRefetch?
|
||||
|
||||
```ts
|
||||
optional cancelRefetch: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:746](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L746)
|
||||
|
||||
If set to `true`, calling `fetchNextPage` repeatedly will invoke `queryFn` every time,
|
||||
whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
|
||||
|
||||
If set to `false`, calling `fetchNextPage` repeatedly won't have any effect until the first invocation has resolved.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:701](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L701)
|
||||
|
||||
If set to `true`, the method throws if any of the underlying query refetch tasks fail.
|
||||
|
||||
Defaults to `false`, in which case failed refetches are swallowed and not surfaced to the
|
||||
caller.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`ResultOptions`](ResultOptions.md).[`throwOnError`](ResultOptions.md#throwonerror)
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: FetchPreviousPageOptions
|
||||
title: FetchPreviousPageOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:749](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L749)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`ResultOptions`](ResultOptions.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### cancelRefetch?
|
||||
|
||||
```ts
|
||||
optional cancelRefetch: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:758](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L758)
|
||||
|
||||
If set to `true`, calling `fetchPreviousPage` repeatedly will invoke `queryFn` every time,
|
||||
whether the previous invocation has resolved or not. Also, the result from previous invocations will be ignored.
|
||||
|
||||
If set to `false`, calling `fetchPreviousPage` repeatedly won't have any effect until the first invocation has resolved.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:701](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L701)
|
||||
|
||||
If set to `true`, the method throws if any of the underlying query refetch tasks fail.
|
||||
|
||||
Defaults to `false`, in which case failed refetches are swallowed and not surfaced to the
|
||||
caller.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`ResultOptions`](ResultOptions.md).[`throwOnError`](ResultOptions.md#throwonerror)
|
||||
364
docs/framework/lit/reference/interfaces/FetchQueryOptions.md
Normal file
364
docs/framework/lit/reference/interfaces/FetchQueryOptions.md
Normal file
@@ -0,0 +1,364 @@
|
||||
---
|
||||
id: FetchQueryOptions
|
||||
title: FetchQueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:595](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L595)
|
||||
|
||||
## Deprecated
|
||||
|
||||
## Extends
|
||||
|
||||
- [`WithRequired`](../type-aliases/WithRequired.md)\<[`QueryOptions`](QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>, `"queryKey"`\>
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`EnsureQueryDataOptions`](EnsureQueryDataOptions.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `never`
|
||||
|
||||
## Properties
|
||||
|
||||
### ~~gcTime?~~
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L277)
|
||||
|
||||
The time in milliseconds that unused/inactive cache data remains in memory.
|
||||
When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.
|
||||
When different garbage collection times are specified, the longest one will be used.
|
||||
Setting it to `Infinity` will disable garbage collection.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
Note: the maximum allowed time is about 24 days, imposed by `setTimeout`'s 32-bit signed integer delay — see
|
||||
`timeoutManager.setTimeoutProvider` for a workaround.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.gcTime
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~initialData?~~
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| TData
|
||||
| InitialDataFunction<TData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:317](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L317)
|
||||
|
||||
If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
||||
created or cached yet).
|
||||
If set to a function, the function will be called **once** during the shared/root query initialization, and be
|
||||
expected to synchronously return the initial data.
|
||||
Initial data is considered stale by default unless a `staleTime` has been set.
|
||||
`initialData` **is persisted** to the cache.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.initialData
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~initialDataUpdatedAt?~~
|
||||
|
||||
```ts
|
||||
optional initialDataUpdatedAt: number | () => number | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L321)
|
||||
|
||||
If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.initialDataUpdatedAt
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~initialPageParam?~~
|
||||
|
||||
```ts
|
||||
optional initialPageParam: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:605](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L605)
|
||||
|
||||
***
|
||||
|
||||
### ~~maxPages?~~
|
||||
|
||||
```ts
|
||||
optional maxPages: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:345](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L345)
|
||||
|
||||
Maximum number of pages to store in the data of an infinite query.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.maxPages
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~meta?~~
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:341](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L341)
|
||||
|
||||
Additional payload to be stored on each query.
|
||||
Use this property to pass information that can be used in other places.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.meta
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~networkMode?~~
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:265](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L265)
|
||||
|
||||
Controls whether a query is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.networkMode
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~persister?~~
|
||||
|
||||
```ts
|
||||
optional persister: QueryPersister<TQueryFnData, NoInfer<TQueryKey>, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L290)
|
||||
|
||||
This option can be used to persist the result of a query to an external storage, bypassing the need to actually
|
||||
call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.persister
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~queryFn?~~
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:285](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L285)
|
||||
|
||||
The function that the query will use to request data.
|
||||
Required, unless a default query function has been set via `queryClient.setQueryDefaults` or
|
||||
`queryClient.setDefaultOptions`.
|
||||
Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md).
|
||||
Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryFn
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~queryHash?~~
|
||||
|
||||
```ts
|
||||
optional queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:295](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L295)
|
||||
|
||||
The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used
|
||||
as the actual cache key internally.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryHash
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~queryKey~~
|
||||
|
||||
```ts
|
||||
queryKey: TQueryKey & object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:304](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L304)
|
||||
|
||||
The query key to use for this query.
|
||||
|
||||
The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys)
|
||||
for more information.
|
||||
|
||||
The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryKey
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~queryKeyHashFn?~~
|
||||
|
||||
```ts
|
||||
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L308)
|
||||
|
||||
If specified, this function is used to hash the `queryKey` to a string.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryKeyHashFn
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~retry?~~
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L246)
|
||||
|
||||
If `false`, failed queries will not retry by default.
|
||||
If `true`, failed queries will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
|
||||
|
||||
Defaults to `3` on the client and `0` on the server.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.retry
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~retryDelay?~~
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:258](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L258)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential
|
||||
backoff.
|
||||
|
||||
A function like `attempt => attempt * 1000` applies linear backoff.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.retryDelay
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### ~~staleTime?~~
|
||||
|
||||
```ts
|
||||
optional staleTime: StaleTimeFunction<TQueryFnData, TError, TData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:610](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L610)
|
||||
|
||||
The time in milliseconds after data is considered stale.
|
||||
If the data is fresh it will be returned from the cache.
|
||||
|
||||
***
|
||||
|
||||
### ~~structuralSharing?~~
|
||||
|
||||
```ts
|
||||
optional structuralSharing: boolean | (oldData, newData) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330)
|
||||
|
||||
Set this to `false` to disable structural sharing between query results.
|
||||
Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.structuralSharing
|
||||
```
|
||||
237
docs/framework/lit/reference/interfaces/FocusManager.md
Normal file
237
docs/framework/lit/reference/interfaces/FocusManager.md
Normal file
@@ -0,0 +1,237 @@
|
||||
---
|
||||
id: FocusManager
|
||||
title: FocusManager
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:14](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L14)
|
||||
|
||||
The `FocusManager` manages the focus state within TanStack Query.
|
||||
|
||||
It can be used to change the default event listeners or to manually change the focus state.
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`Listener`\>
|
||||
|
||||
## Properties
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<Listener>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:2](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L2)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.listeners
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### hasListeners()
|
||||
|
||||
```ts
|
||||
hasListeners(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:19](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L19)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.hasListeners
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### isFocused()
|
||||
|
||||
```ts
|
||||
isFocused(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:128](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L128)
|
||||
|
||||
`isFocused` can be used to get the current focus state.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### onFocus()
|
||||
|
||||
```ts
|
||||
onFocus(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:118](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L118)
|
||||
|
||||
`onFocus` notifies all subscribed listeners with the current focus state.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:39](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L39)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:45](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L45)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setEventListener()
|
||||
|
||||
```ts
|
||||
setEventListener(setup): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:77](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L77)
|
||||
|
||||
`setEventListener` can be used to set a custom event listener that will
|
||||
be used to determine the focus state. The provided `setup` function
|
||||
receives a `setFocused` callback: call it with a `boolean` to manually
|
||||
set the focus state, or with no arguments to re-evaluate the current
|
||||
focus state and notify subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### setup
|
||||
|
||||
`SetupFn`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { focusManager } from '@tanstack/query-core'
|
||||
|
||||
focusManager.setEventListener((handleFocus) => {
|
||||
const listener = () => handleFocus()
|
||||
// Listen to visibilitychange
|
||||
if (typeof window !== 'undefined' && window.addEventListener) {
|
||||
window.addEventListener('visibilitychange', listener, false)
|
||||
}
|
||||
|
||||
return () => {
|
||||
// Be sure to unsubscribe if a new handler is set
|
||||
window.removeEventListener('visibilitychange', listener)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setFocused()
|
||||
|
||||
```ts
|
||||
setFocused(focused?): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/focusManager.ts:107](https://github.com/TanStack/query/blob/main/packages/query-core/src/focusManager.ts#L107)
|
||||
|
||||
`setFocused` can be used to manually set the focus state. Set `undefined`
|
||||
to fall back to the default focus check.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### focused?
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { focusManager } from '@tanstack/query-core'
|
||||
|
||||
// Set focused
|
||||
focusManager.setFocused(true)
|
||||
|
||||
// Set unfocused
|
||||
focusManager.setFocused(false)
|
||||
|
||||
// Fallback to the default focus check
|
||||
focusManager.setFocused(undefined)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### subscribe()
|
||||
|
||||
```ts
|
||||
subscribe(listener): () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:8](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L8)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### listener
|
||||
|
||||
`Listener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
43
docs/framework/lit/reference/interfaces/HydrateOptions.md
Normal file
43
docs/framework/lit/reference/interfaces/HydrateOptions.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: HydrateOptions
|
||||
title: HydrateOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:61](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L61)
|
||||
|
||||
Options for `hydrate`, controlling the default options applied to queries/mutations restored from a
|
||||
`DehydratedState`, and how to reverse any transformation applied by `DehydrateOptions.serializeData`.
|
||||
|
||||
## Properties
|
||||
|
||||
### defaultOptions?
|
||||
|
||||
```ts
|
||||
optional defaultOptions: object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L62)
|
||||
|
||||
#### deserializeData?
|
||||
|
||||
```ts
|
||||
optional deserializeData: TransformerFn;
|
||||
```
|
||||
|
||||
Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`.
|
||||
|
||||
#### mutations?
|
||||
|
||||
```ts
|
||||
optional mutations: MutationOptions<unknown, Error, unknown, unknown>;
|
||||
```
|
||||
|
||||
Default options merged into every mutation restored from the dehydrated state.
|
||||
|
||||
#### queries?
|
||||
|
||||
```ts
|
||||
optional queries: QueryOptions<unknown, Error, unknown, readonly unknown[], never>;
|
||||
```
|
||||
|
||||
Default options merged into every query restored from the dehydrated state.
|
||||
36
docs/framework/lit/reference/interfaces/InfiniteData.md
Normal file
36
docs/framework/lit/reference/interfaces/InfiniteData.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
id: InfiniteData
|
||||
title: InfiniteData
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:210](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L210)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData`
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### pageParams
|
||||
|
||||
```ts
|
||||
pageParams: TPageParam[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:212](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L212)
|
||||
|
||||
***
|
||||
|
||||
### pages
|
||||
|
||||
```ts
|
||||
pages: TData[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:211](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L211)
|
||||
@@ -0,0 +1,577 @@
|
||||
---
|
||||
id: InfiniteQueryObserverBaseResult
|
||||
title: InfiniteQueryObserverBaseResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1001](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1001)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InfiniteQueryObserverPendingResult`](InfiniteQueryObserverPendingResult.md)
|
||||
- [`InfiniteQueryObserverLoadingResult`](InfiniteQueryObserverLoadingResult.md)
|
||||
- [`InfiniteQueryObserverLoadingErrorResult`](InfiniteQueryObserverLoadingErrorResult.md)
|
||||
- [`InfiniteQueryObserverRefetchErrorResult`](InfiniteQueryObserverRefetchErrorResult.md)
|
||||
- [`InfiniteQueryObserverSuccessResult`](InfiniteQueryObserverSuccessResult.md)
|
||||
- [`InfiniteQueryObserverPlaceholderResult`](InfiniteQueryObserverPlaceholderResult.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:771](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L771)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:780](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L780)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:804](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L804)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1028](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1028)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1036](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1036)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:823](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L823)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:831](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L831)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:827](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L827)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:845](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L845)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:849](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L849)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:863](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L863)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: QueryStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:881](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L881)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,600 @@
|
||||
---
|
||||
id: InfiniteQueryObserverLoadingErrorResult
|
||||
title: InfiniteQueryObserverLoadingErrorResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1078](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1078)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1082](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1082)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`data`](InfiniteQueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`dataUpdatedAt`](InfiniteQueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1083](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1083)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`error`](InfiniteQueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdateCount`](InfiniteQueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdatedAt`](InfiniteQueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureCount`](InfiniteQueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureReason`](InfiniteQueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchNextPage`](InfiniteQueryObserverBaseResult.md#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchPreviousPage`](InfiniteQueryObserverBaseResult.md#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchStatus`](InfiniteQueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasNextPage`](InfiniteQueryObserverBaseResult.md#hasnextpage)
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasPreviousPage`](InfiniteQueryObserverBaseResult.md#haspreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isEnabled`](InfiniteQueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1084](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1084)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isError`](InfiniteQueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetched`](InfiniteQueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchedAfterMount`](InfiniteQueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetching`](InfiniteQueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingNextPage`](InfiniteQueryObserverBaseResult.md#isfetchingnextpage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingPreviousPage`](InfiniteQueryObserverBaseResult.md#isfetchingpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1089](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1089)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchNextPageError`](InfiniteQueryObserverBaseResult.md#isfetchnextpageerror)
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1090](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1090)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchPreviousPageError`](InfiniteQueryObserverBaseResult.md#isfetchpreviouspageerror)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isInitialLoading`](InfiniteQueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1086](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1086)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoading`](InfiniteQueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1087](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1087)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoadingError`](InfiniteQueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPaused`](InfiniteQueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1085](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1085)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPending`](InfiniteQueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1092](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1092)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPlaceholderData`](InfiniteQueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1088](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1088)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetchError`](InfiniteQueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetching`](InfiniteQueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isStale`](InfiniteQueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1091](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1091)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isSuccess`](InfiniteQueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`refetch`](InfiniteQueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "error";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1093](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1093)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`status`](InfiniteQueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,600 @@
|
||||
---
|
||||
id: InfiniteQueryObserverLoadingResult
|
||||
title: InfiniteQueryObserverLoadingResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1060](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1060)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1064](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1064)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`data`](InfiniteQueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`dataUpdatedAt`](InfiniteQueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1065](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1065)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`error`](InfiniteQueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdateCount`](InfiniteQueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdatedAt`](InfiniteQueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureCount`](InfiniteQueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureReason`](InfiniteQueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchNextPage`](InfiniteQueryObserverBaseResult.md#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchPreviousPage`](InfiniteQueryObserverBaseResult.md#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchStatus`](InfiniteQueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasNextPage`](InfiniteQueryObserverBaseResult.md#hasnextpage)
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasPreviousPage`](InfiniteQueryObserverBaseResult.md#haspreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isEnabled`](InfiniteQueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1066](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1066)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isError`](InfiniteQueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetched`](InfiniteQueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchedAfterMount`](InfiniteQueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetching`](InfiniteQueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingNextPage`](InfiniteQueryObserverBaseResult.md#isfetchingnextpage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingPreviousPage`](InfiniteQueryObserverBaseResult.md#isfetchingpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1071](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1071)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchNextPageError`](InfiniteQueryObserverBaseResult.md#isfetchnextpageerror)
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1072](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1072)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchPreviousPageError`](InfiniteQueryObserverBaseResult.md#isfetchpreviouspageerror)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isInitialLoading`](InfiniteQueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1068](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1068)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoading`](InfiniteQueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1069](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1069)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoadingError`](InfiniteQueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPaused`](InfiniteQueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1067](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1067)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPending`](InfiniteQueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1074](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1074)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPlaceholderData`](InfiniteQueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1070](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1070)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetchError`](InfiniteQueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetching`](InfiniteQueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isStale`](InfiniteQueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1073](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1073)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isSuccess`](InfiniteQueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`refetch`](InfiniteQueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "pending";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1075](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1075)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`status`](InfiniteQueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,624 @@
|
||||
---
|
||||
id: InfiniteQueryObserverOptions
|
||||
title: InfiniteQueryObserverOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:539](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L539)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverOptions`](QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`, `TPageParam`\>.[`InfiniteQueryPageParamsOptions`](InfiniteQueryPageParamsOptions.md)\<`TQueryFnData`, `TPageParam`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### enabled?
|
||||
|
||||
```ts
|
||||
optional enabled: QueryBooleanOption<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:398](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L398)
|
||||
|
||||
Set this to `false` or a function that returns `false` to disable automatic refetching when the query mounts or changes query keys.
|
||||
To refetch the query, use the `refetch` method returned from the `useQuery` instance.
|
||||
Accepts a boolean or function that returns a boolean.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`enabled`](QueryObserverOptions.md#enabled)
|
||||
|
||||
***
|
||||
|
||||
### gcTime?
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L277)
|
||||
|
||||
The time in milliseconds that unused/inactive cache data remains in memory.
|
||||
When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.
|
||||
When different garbage collection times are specified, the longest one will be used.
|
||||
Setting it to `Infinity` will disable garbage collection.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
Note: the maximum allowed time is about 24 days, imposed by `setTimeout`'s 32-bit signed integer delay — see
|
||||
`timeoutManager.setTimeoutProvider` for a workaround.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`gcTime`](QueryObserverOptions.md#gctime)
|
||||
|
||||
***
|
||||
|
||||
### getNextPageParam
|
||||
|
||||
```ts
|
||||
getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:365](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L365)
|
||||
|
||||
This function can be set to automatically get the next cursor for infinite queries.
|
||||
The result will also be used to determine the value of `hasNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryPageParamsOptions`](InfiniteQueryPageParamsOptions.md).[`getNextPageParam`](InfiniteQueryPageParamsOptions.md#getnextpageparam)
|
||||
|
||||
***
|
||||
|
||||
### getPreviousPageParam?
|
||||
|
||||
```ts
|
||||
optional getPreviousPageParam: GetPreviousPageParamFunction<TPageParam, TQueryFnData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:360](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L360)
|
||||
|
||||
This function can be set to automatically get the previous cursor for infinite queries.
|
||||
The result will also be used to determine the value of `hasPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryPageParamsOptions`](InfiniteQueryPageParamsOptions.md).[`getPreviousPageParam`](InfiniteQueryPageParamsOptions.md#getpreviouspageparam)
|
||||
|
||||
***
|
||||
|
||||
### initialData?
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| InfiniteData<TQueryFnData, TPageParam>
|
||||
| InitialDataFunction<InfiniteData<TQueryFnData, TPageParam>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:317](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L317)
|
||||
|
||||
If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
||||
created or cached yet).
|
||||
If set to a function, the function will be called **once** during the shared/root query initialization, and be
|
||||
expected to synchronously return the initial data.
|
||||
Initial data is considered stale by default unless a `staleTime` has been set.
|
||||
`initialData` **is persisted** to the cache.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`initialData`](QueryObserverOptions.md#initialdata)
|
||||
|
||||
***
|
||||
|
||||
### initialDataUpdatedAt?
|
||||
|
||||
```ts
|
||||
optional initialDataUpdatedAt: number | () => number | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L321)
|
||||
|
||||
If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`initialDataUpdatedAt`](QueryObserverOptions.md#initialdataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### initialPageParam
|
||||
|
||||
```ts
|
||||
initialPageParam: TPageParam;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:349](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L349)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryPageParamsOptions`](InfiniteQueryPageParamsOptions.md).[`initialPageParam`](InfiniteQueryPageParamsOptions.md#initialpageparam)
|
||||
|
||||
***
|
||||
|
||||
### maxPages?
|
||||
|
||||
```ts
|
||||
optional maxPages: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:345](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L345)
|
||||
|
||||
Maximum number of pages to store in the data of an infinite query.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`maxPages`](QueryObserverOptions.md#maxpages)
|
||||
|
||||
***
|
||||
|
||||
### meta?
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:341](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L341)
|
||||
|
||||
Additional payload to be stored on each query.
|
||||
Use this property to pass information that can be used in other places.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`meta`](QueryObserverOptions.md#meta)
|
||||
|
||||
***
|
||||
|
||||
### networkMode?
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:265](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L265)
|
||||
|
||||
Controls whether a query is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`networkMode`](QueryObserverOptions.md#networkmode)
|
||||
|
||||
***
|
||||
|
||||
### notifyOnChangeProps?
|
||||
|
||||
```ts
|
||||
optional notifyOnChangeProps: NotifyOnChangeProps;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:484](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L484)
|
||||
|
||||
If set, the component will only re-render if any of the listed properties change.
|
||||
When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change.
|
||||
When set to `'all'`, the component will re-render whenever a query is updated.
|
||||
When set to a function, the function will be executed to compute the list of properties.
|
||||
|
||||
Defaults to `undefined`, in which case property access is tracked automatically, and the
|
||||
component only re-renders when one of the tracked properties changes.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`notifyOnChangeProps`](QueryObserverOptions.md#notifyonchangeprops)
|
||||
|
||||
***
|
||||
|
||||
### persister?
|
||||
|
||||
```ts
|
||||
optional persister: QueryPersister<TQueryFnData, NoInfer<TQueryKey>, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L290)
|
||||
|
||||
This option can be used to persist the result of a query to an external storage, bypassing the need to actually
|
||||
call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`persister`](QueryObserverOptions.md#persister)
|
||||
|
||||
***
|
||||
|
||||
### placeholderData?
|
||||
|
||||
```ts
|
||||
optional placeholderData:
|
||||
| InfiniteData<TQueryFnData, TPageParam>
|
||||
| PlaceholderDataFunction<InfiniteData<TQueryFnData, TPageParam>, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:511](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L511)
|
||||
|
||||
If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`placeholderData`](QueryObserverOptions.md#placeholderdata)
|
||||
|
||||
***
|
||||
|
||||
### queryFn?
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:285](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L285)
|
||||
|
||||
The function that the query will use to request data.
|
||||
Required, unless a default query function has been set via `queryClient.setQueryDefaults` or
|
||||
`queryClient.setDefaultOptions`.
|
||||
Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md).
|
||||
Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`queryFn`](QueryObserverOptions.md#queryfn)
|
||||
|
||||
***
|
||||
|
||||
### queryHash?
|
||||
|
||||
```ts
|
||||
optional queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:295](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L295)
|
||||
|
||||
The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used
|
||||
as the actual cache key internally.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`queryHash`](QueryObserverOptions.md#queryhash)
|
||||
|
||||
***
|
||||
|
||||
### queryKey
|
||||
|
||||
```ts
|
||||
queryKey: TQueryKey & object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:304](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L304)
|
||||
|
||||
The query key to use for this query.
|
||||
|
||||
The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys)
|
||||
for more information.
|
||||
|
||||
The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`queryKey`](QueryObserverOptions.md#querykey)
|
||||
|
||||
***
|
||||
|
||||
### queryKeyHashFn?
|
||||
|
||||
```ts
|
||||
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L308)
|
||||
|
||||
If specified, this function is used to hash the `queryKey` to a string.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`queryKeyHashFn`](QueryObserverOptions.md#querykeyhashfn)
|
||||
|
||||
***
|
||||
|
||||
### refetchInterval?
|
||||
|
||||
```ts
|
||||
optional refetchInterval: number | false | (query) => number | false | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:414](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L414)
|
||||
|
||||
If set to a number, the query will continuously refetch at this frequency in milliseconds.
|
||||
If set to a function, the function will be executed with the latest data and query to compute a frequency
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`refetchInterval`](QueryObserverOptions.md#refetchinterval)
|
||||
|
||||
***
|
||||
|
||||
### refetchIntervalInBackground?
|
||||
|
||||
```ts
|
||||
optional refetchIntervalInBackground: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:425](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L425)
|
||||
|
||||
If set to `true`, the query will continue to refetch while their tab/window is in the background.
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`refetchIntervalInBackground`](QueryObserverOptions.md#refetchintervalinbackground)
|
||||
|
||||
***
|
||||
|
||||
### refetchOnMount?
|
||||
|
||||
```ts
|
||||
optional refetchOnMount: boolean | "always" | (query) => boolean | "always";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:462](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L462)
|
||||
|
||||
If set to `true`, the query will refetch on mount if the data is stale.
|
||||
If set to `false`, will disable additional instances of a query to trigger background refetch.
|
||||
If set to `'always'`, the query will always refetch on mount (except when `staleTime: 'static'` is used).
|
||||
If set to a function, the function will be executed with the latest data and query to compute the value
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`refetchOnMount`](QueryObserverOptions.md#refetchonmount)
|
||||
|
||||
***
|
||||
|
||||
### refetchOnReconnect?
|
||||
|
||||
```ts
|
||||
optional refetchOnReconnect: boolean | "always" | (query) => boolean | "always";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:448](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L448)
|
||||
|
||||
If set to `true`, the query will refetch on reconnect if the data is stale.
|
||||
If set to `false`, the query will not refetch on reconnect.
|
||||
If set to `'always'`, the query will always refetch on reconnect (except when `staleTime: 'static'` is used).
|
||||
If set to a function, the function will be executed with the latest data and query to compute the value.
|
||||
|
||||
Defaults to `true` unless `networkMode` is `'always'`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`refetchOnReconnect`](QueryObserverOptions.md#refetchonreconnect)
|
||||
|
||||
***
|
||||
|
||||
### refetchOnWindowFocus?
|
||||
|
||||
```ts
|
||||
optional refetchOnWindowFocus: boolean | "always" | (query) => boolean | "always";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:434](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L434)
|
||||
|
||||
If set to `true`, the query will refetch on window focus if the data is stale.
|
||||
If set to `false`, the query will not refetch on window focus.
|
||||
If set to `'always'`, the query will always refetch on window focus (except when `staleTime: 'static'` is used).
|
||||
If set to a function, the function will be executed with the latest data and query to compute the value.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`refetchOnWindowFocus`](QueryObserverOptions.md#refetchonwindowfocus)
|
||||
|
||||
***
|
||||
|
||||
### retry?
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L246)
|
||||
|
||||
If `false`, failed queries will not retry by default.
|
||||
If `true`, failed queries will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
|
||||
|
||||
Defaults to `3` on the client and `0` on the server.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`retry`](QueryObserverOptions.md#retry)
|
||||
|
||||
***
|
||||
|
||||
### retryDelay?
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:258](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L258)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential
|
||||
backoff.
|
||||
|
||||
A function like `attempt => attempt * 1000` applies linear backoff.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`retryDelay`](QueryObserverOptions.md#retrydelay)
|
||||
|
||||
***
|
||||
|
||||
### retryOnMount?
|
||||
|
||||
```ts
|
||||
optional retryOnMount: QueryBooleanOption<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:474](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L474)
|
||||
|
||||
If set to `false`, the query will not be retried on mount if it contains an error.
|
||||
If set to a function, the function will be executed with the query to compute the value.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`retryOnMount`](QueryObserverOptions.md#retryonmount)
|
||||
|
||||
***
|
||||
|
||||
### select()?
|
||||
|
||||
```ts
|
||||
optional select: (data) => TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:500](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L500)
|
||||
|
||||
This option can be used to transform or select a part of the data returned by the query function. It affects
|
||||
the returned `data` value, but does not affect what gets stored in the query cache.
|
||||
The `select` function will only run if `data` changed, or if the reference to the `select` function itself
|
||||
changes. To optimize, memoize the function so its reference stays stable across calls.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
[`InfiniteData`](InfiniteData.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`TData`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`select`](QueryObserverOptions.md#select)
|
||||
|
||||
***
|
||||
|
||||
### staleTime?
|
||||
|
||||
```ts
|
||||
optional staleTime: StaleTimeFunction<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:407](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L407)
|
||||
|
||||
The time in milliseconds after data is considered stale.
|
||||
If set to `Infinity`, the data will never be considered stale.
|
||||
If set to `'static'`, the data will never be considered stale.
|
||||
If set to a function, the function will be executed with the query to compute a `staleTime`.
|
||||
|
||||
Defaults to `0`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`staleTime`](QueryObserverOptions.md#staletime)
|
||||
|
||||
***
|
||||
|
||||
### structuralSharing?
|
||||
|
||||
```ts
|
||||
optional structuralSharing: boolean | (oldData, newData) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330)
|
||||
|
||||
Set this to `false` to disable structural sharing between query results.
|
||||
Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`structuralSharing`](QueryObserverOptions.md#structuralsharing)
|
||||
|
||||
***
|
||||
|
||||
### suspense?
|
||||
|
||||
```ts
|
||||
optional suspense: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:507](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L507)
|
||||
|
||||
If set to `true`, the query will suspend when `status === 'pending'`
|
||||
and throw errors when `status === 'error'`.
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`suspense`](QueryObserverOptions.md#suspense)
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: ThrowOnError<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:493](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L493)
|
||||
|
||||
Whether errors should be thrown instead of setting the `error` property.
|
||||
If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary.
|
||||
If set to `false` and `suspense` is `false`, errors are returned as state.
|
||||
If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`).
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`throwOnError`](QueryObserverOptions.md#throwonerror)
|
||||
@@ -0,0 +1,600 @@
|
||||
---
|
||||
id: InfiniteQueryObserverPendingResult
|
||||
title: InfiniteQueryObserverPendingResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1043](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1043)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1047](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1047)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`data`](InfiniteQueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`dataUpdatedAt`](InfiniteQueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1048](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1048)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`error`](InfiniteQueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdateCount`](InfiniteQueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdatedAt`](InfiniteQueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureCount`](InfiniteQueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureReason`](InfiniteQueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchNextPage`](InfiniteQueryObserverBaseResult.md#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchPreviousPage`](InfiniteQueryObserverBaseResult.md#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchStatus`](InfiniteQueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasNextPage`](InfiniteQueryObserverBaseResult.md#hasnextpage)
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasPreviousPage`](InfiniteQueryObserverBaseResult.md#haspreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isEnabled`](InfiniteQueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1049](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1049)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isError`](InfiniteQueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetched`](InfiniteQueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchedAfterMount`](InfiniteQueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetching`](InfiniteQueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingNextPage`](InfiniteQueryObserverBaseResult.md#isfetchingnextpage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingPreviousPage`](InfiniteQueryObserverBaseResult.md#isfetchingpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1053](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1053)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchNextPageError`](InfiniteQueryObserverBaseResult.md#isfetchnextpageerror)
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1054](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1054)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchPreviousPageError`](InfiniteQueryObserverBaseResult.md#isfetchpreviouspageerror)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isInitialLoading`](InfiniteQueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:823](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L823)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoading`](InfiniteQueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1051](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1051)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoadingError`](InfiniteQueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPaused`](InfiniteQueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1050](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1050)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPending`](InfiniteQueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1056](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1056)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPlaceholderData`](InfiniteQueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1052](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1052)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetchError`](InfiniteQueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetching`](InfiniteQueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isStale`](InfiniteQueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1055](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1055)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isSuccess`](InfiniteQueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`refetch`](InfiniteQueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "pending";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1057](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1057)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`status`](InfiniteQueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,600 @@
|
||||
---
|
||||
id: InfiniteQueryObserverPlaceholderResult
|
||||
title: InfiniteQueryObserverPlaceholderResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1130](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1130)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1134](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1134)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`data`](InfiniteQueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`dataUpdatedAt`](InfiniteQueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1136](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1136)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`error`](InfiniteQueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdateCount`](InfiniteQueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdatedAt`](InfiniteQueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureCount`](InfiniteQueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureReason`](InfiniteQueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchNextPage`](InfiniteQueryObserverBaseResult.md#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchPreviousPage`](InfiniteQueryObserverBaseResult.md#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchStatus`](InfiniteQueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasNextPage`](InfiniteQueryObserverBaseResult.md#hasnextpage)
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasPreviousPage`](InfiniteQueryObserverBaseResult.md#haspreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isEnabled`](InfiniteQueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1135](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1135)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isError`](InfiniteQueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetched`](InfiniteQueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchedAfterMount`](InfiniteQueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetching`](InfiniteQueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingNextPage`](InfiniteQueryObserverBaseResult.md#isfetchingnextpage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingPreviousPage`](InfiniteQueryObserverBaseResult.md#isfetchingpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1143](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1143)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchNextPageError`](InfiniteQueryObserverBaseResult.md#isfetchnextpageerror)
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1144](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1144)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchPreviousPageError`](InfiniteQueryObserverBaseResult.md#isfetchpreviouspageerror)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isInitialLoading`](InfiniteQueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1138](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1138)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoading`](InfiniteQueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1139](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1139)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoadingError`](InfiniteQueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPaused`](InfiniteQueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1137)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPending`](InfiniteQueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1142](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1142)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPlaceholderData`](InfiniteQueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1140](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1140)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetchError`](InfiniteQueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetching`](InfiniteQueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isStale`](InfiniteQueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1141](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1141)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isSuccess`](InfiniteQueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`refetch`](InfiniteQueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "success";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1145](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1145)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`status`](InfiniteQueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,600 @@
|
||||
---
|
||||
id: InfiniteQueryObserverRefetchErrorResult
|
||||
title: InfiniteQueryObserverRefetchErrorResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1096](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1096)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1100](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1100)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`data`](InfiniteQueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`dataUpdatedAt`](InfiniteQueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1101](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1101)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`error`](InfiniteQueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdateCount`](InfiniteQueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdatedAt`](InfiniteQueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureCount`](InfiniteQueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureReason`](InfiniteQueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchNextPage`](InfiniteQueryObserverBaseResult.md#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchPreviousPage`](InfiniteQueryObserverBaseResult.md#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchStatus`](InfiniteQueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasNextPage`](InfiniteQueryObserverBaseResult.md#hasnextpage)
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasPreviousPage`](InfiniteQueryObserverBaseResult.md#haspreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isEnabled`](InfiniteQueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1102](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1102)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isError`](InfiniteQueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetched`](InfiniteQueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchedAfterMount`](InfiniteQueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetching`](InfiniteQueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingNextPage`](InfiniteQueryObserverBaseResult.md#isfetchingnextpage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingPreviousPage`](InfiniteQueryObserverBaseResult.md#isfetchingpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1028](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1028)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchNextPageError`](InfiniteQueryObserverBaseResult.md#isfetchnextpageerror)
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1036](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1036)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchPreviousPageError`](InfiniteQueryObserverBaseResult.md#isfetchpreviouspageerror)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isInitialLoading`](InfiniteQueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1104](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1104)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoading`](InfiniteQueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1105](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1105)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoadingError`](InfiniteQueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPaused`](InfiniteQueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1103](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1103)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPending`](InfiniteQueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1108](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1108)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPlaceholderData`](InfiniteQueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1106](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1106)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetchError`](InfiniteQueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetching`](InfiniteQueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isStale`](InfiniteQueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1107](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1107)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isSuccess`](InfiniteQueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`refetch`](InfiniteQueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "error";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1109](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1109)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`status`](InfiniteQueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,600 @@
|
||||
---
|
||||
id: InfiniteQueryObserverSuccessResult
|
||||
title: InfiniteQueryObserverSuccessResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1112](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1112)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1116](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1116)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`data`](InfiniteQueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`dataUpdatedAt`](InfiniteQueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1117](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1117)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`error`](InfiniteQueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdateCount`](InfiniteQueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`errorUpdatedAt`](InfiniteQueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureCount`](InfiniteQueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`failureReason`](InfiniteQueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1008](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1008)
|
||||
|
||||
This function allows you to fetch the next "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchNextPage`](InfiniteQueryObserverBaseResult.md#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage: (options?) => Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1014](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1014)
|
||||
|
||||
This function allows you to fetch the previous "page" of results.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchPreviousPage`](InfiniteQueryObserverBaseResult.md#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`fetchStatus`](InfiniteQueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### hasNextPage
|
||||
|
||||
```ts
|
||||
hasNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1020](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1020)
|
||||
|
||||
Will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasNextPage`](InfiniteQueryObserverBaseResult.md#hasnextpage)
|
||||
|
||||
***
|
||||
|
||||
### hasPreviousPage
|
||||
|
||||
```ts
|
||||
hasPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1024](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1024)
|
||||
|
||||
Will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`hasPreviousPage`](InfiniteQueryObserverBaseResult.md#haspreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isEnabled`](InfiniteQueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1118](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1118)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isError`](InfiniteQueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetched`](InfiniteQueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchedAfterMount`](InfiniteQueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetching`](InfiniteQueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingNextPage
|
||||
|
||||
```ts
|
||||
isFetchingNextPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1032](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1032)
|
||||
|
||||
Will be `true` while fetching the next page with `fetchNextPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingNextPage`](InfiniteQueryObserverBaseResult.md#isfetchingnextpage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchingPreviousPage
|
||||
|
||||
```ts
|
||||
isFetchingPreviousPage: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1040](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1040)
|
||||
|
||||
Will be `true` while fetching the previous page with `fetchPreviousPage`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchingPreviousPage`](InfiniteQueryObserverBaseResult.md#isfetchingpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### isFetchNextPageError
|
||||
|
||||
```ts
|
||||
isFetchNextPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1123](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1123)
|
||||
|
||||
Will be `true` if the query failed while fetching the next page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchNextPageError`](InfiniteQueryObserverBaseResult.md#isfetchnextpageerror)
|
||||
|
||||
***
|
||||
|
||||
### isFetchPreviousPageError
|
||||
|
||||
```ts
|
||||
isFetchPreviousPageError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1124](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1124)
|
||||
|
||||
Will be `true` if the query failed while fetching the previous page.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isFetchPreviousPageError`](InfiniteQueryObserverBaseResult.md#isfetchpreviouspageerror)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isInitialLoading`](InfiniteQueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1120](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1120)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoading`](InfiniteQueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1121](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1121)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isLoadingError`](InfiniteQueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPaused`](InfiniteQueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1119](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1119)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPending`](InfiniteQueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1126](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1126)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isPlaceholderData`](InfiniteQueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1122)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetchError`](InfiniteQueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isRefetching`](InfiniteQueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isStale`](InfiniteQueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1125](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1125)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`isSuccess`](InfiniteQueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`refetch`](InfiniteQueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "success";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1127](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1127)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md).[`status`](InfiniteQueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
id: InfiniteQueryPageParamsOptions
|
||||
title: InfiniteQueryPageParamsOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:352](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L352)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`InitialPageParam`](InitialPageParam.md)\<`TPageParam`\>
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InfiniteQueryObserverOptions`](InfiniteQueryObserverOptions.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### getNextPageParam
|
||||
|
||||
```ts
|
||||
getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:365](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L365)
|
||||
|
||||
This function can be set to automatically get the next cursor for infinite queries.
|
||||
The result will also be used to determine the value of `hasNextPage`.
|
||||
|
||||
***
|
||||
|
||||
### getPreviousPageParam?
|
||||
|
||||
```ts
|
||||
optional getPreviousPageParam: GetPreviousPageParamFunction<TPageParam, TQueryFnData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:360](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L360)
|
||||
|
||||
This function can be set to automatically get the previous cursor for infinite queries.
|
||||
The result will also be used to determine the value of `hasPreviousPage`.
|
||||
|
||||
***
|
||||
|
||||
### initialPageParam
|
||||
|
||||
```ts
|
||||
initialPageParam: TPageParam;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:349](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L349)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`InitialPageParam`](InitialPageParam.md).[`initialPageParam`](InitialPageParam.md#initialpageparam)
|
||||
26
docs/framework/lit/reference/interfaces/InitialPageParam.md
Normal file
26
docs/framework/lit/reference/interfaces/InitialPageParam.md
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
id: InitialPageParam
|
||||
title: InitialPageParam
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:348](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L348)
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InfiniteQueryPageParamsOptions`](InfiniteQueryPageParamsOptions.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### initialPageParam
|
||||
|
||||
```ts
|
||||
initialPageParam: TPageParam;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:349](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L349)
|
||||
49
docs/framework/lit/reference/interfaces/InvalidateOptions.md
Normal file
49
docs/framework/lit/reference/interfaces/InvalidateOptions.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
id: InvalidateOptions
|
||||
title: InvalidateOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:734](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L734)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### cancelRefetch?
|
||||
|
||||
```ts
|
||||
optional cancelRefetch: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:712](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L712)
|
||||
|
||||
If set to `true`, a currently running request will be cancelled before a new request is made
|
||||
|
||||
If set to `false`, no refetch will be made if there is already a request running.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md).[`cancelRefetch`](RefetchOptions.md#cancelrefetch)
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:701](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L701)
|
||||
|
||||
If set to `true`, the method throws if any of the underlying query refetch tasks fail.
|
||||
|
||||
Defaults to `false`, in which case failed refetches are swallowed and not surfaced to the
|
||||
caller.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md).[`throwOnError`](RefetchOptions.md#throwonerror)
|
||||
@@ -0,0 +1,145 @@
|
||||
---
|
||||
id: InvalidateQueryFilters
|
||||
title: InvalidateQueryFilters
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:715](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L715)
|
||||
|
||||
Filters used to select queries, for example in `queryClient.getQueriesData` or `queryClient.invalidateQueries`.
|
||||
All provided filters must match; filters that are left unspecified are ignored.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryFilters`](QueryFilters.md)\<`TQueryKey`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### exact?
|
||||
|
||||
```ts
|
||||
optional exact: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:41](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L41)
|
||||
|
||||
Match query key exactly
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`exact`](QueryFilters.md#exact)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus?
|
||||
|
||||
```ts
|
||||
optional fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L57)
|
||||
|
||||
Include queries matching their fetchStatus
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`fetchStatus`](QueryFilters.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### predicate()?
|
||||
|
||||
```ts
|
||||
optional predicate: (query) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:45](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L45)
|
||||
|
||||
Include queries matching this predicate function
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`predicate`](QueryFilters.md#predicate)
|
||||
|
||||
***
|
||||
|
||||
### queryKey?
|
||||
|
||||
```ts
|
||||
optional queryKey: TQueryKey | TuplePrefixes<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:49](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L49)
|
||||
|
||||
Include queries matching this query key
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`queryKey`](QueryFilters.md#querykey)
|
||||
|
||||
***
|
||||
|
||||
### refetchType?
|
||||
|
||||
```ts
|
||||
optional refetchType: QueryTypeFilter | "none";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:727](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L727)
|
||||
|
||||
Controls which of the matched (now-invalidated) queries are refetched in the background.
|
||||
|
||||
Defaults to `'active'`.
|
||||
- `'active'`: only queries with at least one active observer are refetched.
|
||||
- `'inactive'`: only queries with no active observer are refetched.
|
||||
- `'all'`: every matched query is refetched, active or not.
|
||||
- `'none'`: no query is refetched; matched queries are only marked as invalidated.
|
||||
|
||||
***
|
||||
|
||||
### stale?
|
||||
|
||||
```ts
|
||||
optional stale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L53)
|
||||
|
||||
Include or exclude stale queries
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`stale`](QueryFilters.md#stale)
|
||||
|
||||
***
|
||||
|
||||
### type?
|
||||
|
||||
```ts
|
||||
optional type: QueryTypeFilter;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:37](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L37)
|
||||
|
||||
Filter to active queries, inactive queries or all queries
|
||||
|
||||
Defaults to `'all'`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`type`](QueryFilters.md#type)
|
||||
124
docs/framework/lit/reference/interfaces/MutateOptions.md
Normal file
124
docs/framework/lit/reference/interfaces/MutateOptions.md
Normal file
@@ -0,0 +1,124 @@
|
||||
---
|
||||
id: MutateOptions
|
||||
title: MutateOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1284](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1284)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### onError()?
|
||||
|
||||
```ts
|
||||
optional onError: (error, variables, onMutateResult, context) => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1296](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1296)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### error
|
||||
|
||||
`TError`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### onSettled()?
|
||||
|
||||
```ts
|
||||
optional onSettled: (data, error, variables, onMutateResult, context) => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1302](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1302)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TData` | `undefined`
|
||||
|
||||
##### error
|
||||
|
||||
`TError` | `null`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### onSuccess()?
|
||||
|
||||
```ts
|
||||
optional onSuccess: (data, variables, onMutateResult, context) => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1290)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TData`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
161
docs/framework/lit/reference/interfaces/MutationCacheConfig.md
Normal file
161
docs/framework/lit/reference/interfaces/MutationCacheConfig.md
Normal file
@@ -0,0 +1,161 @@
|
||||
---
|
||||
id: MutationCacheConfig
|
||||
title: MutationCacheConfig
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:26](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L26)
|
||||
|
||||
Global callbacks that fire for every mutation handled by a `MutationCache`, regardless of which
|
||||
component or observer triggered it. They differ from the `defaultOptions` provided to a
|
||||
`QueryClient` in two ways: `defaultOptions` can be overridden by each mutation, while these
|
||||
callbacks are always called, and `onMutate` here does not allow returning a result.
|
||||
|
||||
If a callback returns a promise, it will be awaited before the mutation continues.
|
||||
|
||||
## Properties
|
||||
|
||||
### onError()?
|
||||
|
||||
```ts
|
||||
optional onError: (error, variables, onMutateResult, mutation, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L28)
|
||||
|
||||
Called when any mutation in the cache encounters an error.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### error
|
||||
|
||||
`Error`
|
||||
|
||||
##### variables
|
||||
|
||||
`unknown`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`unknown`
|
||||
|
||||
##### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### onMutate()?
|
||||
|
||||
```ts
|
||||
optional onMutate: (variables, mutation, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:44](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L44)
|
||||
|
||||
Called before any mutation in the cache executes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### variables
|
||||
|
||||
`unknown`
|
||||
|
||||
##### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### onSettled()?
|
||||
|
||||
```ts
|
||||
optional onSettled: (data, error, variables, onMutateResult, mutation, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:50](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L50)
|
||||
|
||||
Called when any mutation in the cache is settled, either successfully or with an error.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`unknown`
|
||||
|
||||
##### error
|
||||
|
||||
`Error` | `null`
|
||||
|
||||
##### variables
|
||||
|
||||
`unknown`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`unknown`
|
||||
|
||||
##### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### onSuccess()?
|
||||
|
||||
```ts
|
||||
optional onSuccess: (data, variables, onMutateResult, mutation, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:36](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L36)
|
||||
|
||||
Called when any mutation in the cache is successful.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`unknown`
|
||||
|
||||
##### variables
|
||||
|
||||
`unknown`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`unknown`
|
||||
|
||||
##### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
85
docs/framework/lit/reference/interfaces/MutationFilters.md
Normal file
85
docs/framework/lit/reference/interfaces/MutationFilters.md
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
id: MutationFilters
|
||||
title: MutationFilters
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:64](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L64)
|
||||
|
||||
Filters used to select mutations, for example in `mutationCache.findAll` or `queryClient.isMutating`.
|
||||
All provided filters must match; filters that are left unspecified are ignored.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `unknown`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### exact?
|
||||
|
||||
```ts
|
||||
optional exact: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:73](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L73)
|
||||
|
||||
Match mutation key exactly
|
||||
|
||||
***
|
||||
|
||||
### mutationKey?
|
||||
|
||||
```ts
|
||||
optional mutationKey: readonly unknown[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L83)
|
||||
|
||||
Include mutations matching this mutation key
|
||||
|
||||
***
|
||||
|
||||
### predicate()?
|
||||
|
||||
```ts
|
||||
optional predicate: (mutation) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:77](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L77)
|
||||
|
||||
Include mutations matching this predicate function
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### status?
|
||||
|
||||
```ts
|
||||
optional status: MutationStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:87](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L87)
|
||||
|
||||
Filter by mutation status
|
||||
@@ -0,0 +1,291 @@
|
||||
---
|
||||
id: MutationObserverBaseResult
|
||||
title: MutationObserverBaseResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1335](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1335)
|
||||
|
||||
The raw state stored on a `Mutation` instance. This is the underlying state
|
||||
that observer results (e.g. `MutationObserverResult`) are derived from.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`MutationState`](MutationState.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`MutationObserverIdleResult`](MutationObserverIdleResult.md)
|
||||
- [`MutationObserverLoadingResult`](MutationObserverLoadingResult.md)
|
||||
- [`MutationObserverErrorResult`](MutationObserverErrorResult.md)
|
||||
- [`MutationObserverSuccessResult`](MutationObserverSuccessResult.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### context
|
||||
|
||||
```ts
|
||||
context: TOnMutateResult | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:40](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L40)
|
||||
|
||||
The value returned by `onMutate`, if defined. Passed to `onSuccess`,
|
||||
`onError` and `onSettled` as the mutation's context.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationState`](MutationState.md).[`context`](MutationState.md#context)
|
||||
|
||||
***
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1344](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1344)
|
||||
|
||||
The last successfully resolved data for the mutation.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationState`](MutationState.md).[`data`](MutationState.md#data)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1353](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1353)
|
||||
|
||||
The error object for the mutation, if an error was encountered.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationState`](MutationState.md).[`error`](MutationState.md#error)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L53)
|
||||
|
||||
The number of times the mutation function has failed for the current attempt.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationState`](MutationState.md).[`failureCount`](MutationState.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L57)
|
||||
|
||||
The reason the current attempt failed, as reported by the retryer.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationState`](MutationState.md).[`failureReason`](MutationState.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1358](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1358)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt resulted in an error.
|
||||
|
||||
***
|
||||
|
||||
### isIdle
|
||||
|
||||
```ts
|
||||
isIdle: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1363](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1363)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is in its initial state prior to executing.
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L62)
|
||||
|
||||
Whether the mutation is currently paused (see network mode), or is
|
||||
waiting for another mutation with the same `scope` to finish.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationState`](MutationState.md).[`isPaused`](MutationState.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1368](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1368)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is currently executing.
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1373](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1373)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt was successful.
|
||||
|
||||
***
|
||||
|
||||
### mutate
|
||||
|
||||
```ts
|
||||
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1393](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1393)
|
||||
|
||||
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
|
||||
|
||||
#### Param
|
||||
|
||||
The variables object to pass to the `mutationFn`.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is successful and will be passed the mutation's result.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire if the mutation encounters an error and will be passed the error.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
|
||||
|
||||
#### Remarks
|
||||
|
||||
- If you make multiple requests, `onSuccess` will fire only after the latest call you've made.
|
||||
- All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored.
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset: () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1397](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1397)
|
||||
|
||||
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: MutationStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1382](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1382)
|
||||
|
||||
The status of the mutation.
|
||||
- Will be:
|
||||
- `idle` initial status prior to the mutation function executing.
|
||||
- `pending` if the mutation is currently executing.
|
||||
- `error` if the last mutation attempt resulted in an error.
|
||||
- `success` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationState`](MutationState.md).[`status`](MutationState.md#status)
|
||||
|
||||
***
|
||||
|
||||
### submittedAt
|
||||
|
||||
```ts
|
||||
submittedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:74](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L74)
|
||||
|
||||
The timestamp for when the mutation was submitted.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationState`](MutationState.md).[`submittedAt`](MutationState.md#submittedat)
|
||||
|
||||
***
|
||||
|
||||
### variables
|
||||
|
||||
```ts
|
||||
variables: TVariables | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1348](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1348)
|
||||
|
||||
The variables object passed to the `mutationFn`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationState`](MutationState.md).[`variables`](MutationState.md#variables)
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
id: MutationObserverErrorResult
|
||||
title: MutationObserverErrorResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1442](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1442)
|
||||
|
||||
The raw state stored on a `Mutation` instance. This is the underlying state
|
||||
that observer results (e.g. `MutationObserverResult`) are derived from.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`MutationObserverBaseResult`](MutationObserverBaseResult.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### context
|
||||
|
||||
```ts
|
||||
context: TOnMutateResult | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:40](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L40)
|
||||
|
||||
The value returned by `onMutate`, if defined. Passed to `onSuccess`,
|
||||
`onError` and `onSettled` as the mutation's context.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`context`](MutationObserverBaseResult.md#context)
|
||||
|
||||
***
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1453](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1453)
|
||||
|
||||
The last successfully resolved data for the mutation.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`data`](MutationObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1454](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1454)
|
||||
|
||||
The error object for the mutation, if an error was encountered.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`error`](MutationObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L53)
|
||||
|
||||
The number of times the mutation function has failed for the current attempt.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureCount`](MutationObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L57)
|
||||
|
||||
The reason the current attempt failed, as reported by the retryer.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureReason`](MutationObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1456](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1456)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isError`](MutationObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isIdle
|
||||
|
||||
```ts
|
||||
isIdle: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1457](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1457)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is in its initial state prior to executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isIdle`](MutationObserverBaseResult.md#isidle)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L62)
|
||||
|
||||
Whether the mutation is currently paused (see network mode), or is
|
||||
waiting for another mutation with the same `scope` to finish.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPaused`](MutationObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1458](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1458)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is currently executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPending`](MutationObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1459](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1459)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isSuccess`](MutationObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### mutate
|
||||
|
||||
```ts
|
||||
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1393](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1393)
|
||||
|
||||
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
|
||||
|
||||
#### Param
|
||||
|
||||
The variables object to pass to the `mutationFn`.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is successful and will be passed the mutation's result.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire if the mutation encounters an error and will be passed the error.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
|
||||
|
||||
#### Remarks
|
||||
|
||||
- If you make multiple requests, `onSuccess` will fire only after the latest call you've made.
|
||||
- All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`mutate`](MutationObserverBaseResult.md#mutate)
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset: () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1397](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1397)
|
||||
|
||||
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`reset`](MutationObserverBaseResult.md#reset)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "error";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1460](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1460)
|
||||
|
||||
The status of the mutation.
|
||||
- Will be:
|
||||
- `idle` initial status prior to the mutation function executing.
|
||||
- `pending` if the mutation is currently executing.
|
||||
- `error` if the last mutation attempt resulted in an error.
|
||||
- `success` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`status`](MutationObserverBaseResult.md#status)
|
||||
|
||||
***
|
||||
|
||||
### submittedAt
|
||||
|
||||
```ts
|
||||
submittedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:74](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L74)
|
||||
|
||||
The timestamp for when the mutation was submitted.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`submittedAt`](MutationObserverBaseResult.md#submittedat)
|
||||
|
||||
***
|
||||
|
||||
### variables
|
||||
|
||||
```ts
|
||||
variables: TVariables;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1455](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1455)
|
||||
|
||||
The variables object passed to the `mutationFn`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`variables`](MutationObserverBaseResult.md#variables)
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
id: MutationObserverIdleResult
|
||||
title: MutationObserverIdleResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1400](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1400)
|
||||
|
||||
The raw state stored on a `Mutation` instance. This is the underlying state
|
||||
that observer results (e.g. `MutationObserverResult`) are derived from.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`MutationObserverBaseResult`](MutationObserverBaseResult.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### context
|
||||
|
||||
```ts
|
||||
context: TOnMutateResult | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:40](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L40)
|
||||
|
||||
The value returned by `onMutate`, if defined. Passed to `onSuccess`,
|
||||
`onError` and `onSettled` as the mutation's context.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`context`](MutationObserverBaseResult.md#context)
|
||||
|
||||
***
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1411](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1411)
|
||||
|
||||
The last successfully resolved data for the mutation.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`data`](MutationObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1413](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1413)
|
||||
|
||||
The error object for the mutation, if an error was encountered.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`error`](MutationObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L53)
|
||||
|
||||
The number of times the mutation function has failed for the current attempt.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureCount`](MutationObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L57)
|
||||
|
||||
The reason the current attempt failed, as reported by the retryer.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureReason`](MutationObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1414](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1414)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isError`](MutationObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isIdle
|
||||
|
||||
```ts
|
||||
isIdle: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1415](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1415)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is in its initial state prior to executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isIdle`](MutationObserverBaseResult.md#isidle)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L62)
|
||||
|
||||
Whether the mutation is currently paused (see network mode), or is
|
||||
waiting for another mutation with the same `scope` to finish.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPaused`](MutationObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1416](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1416)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is currently executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPending`](MutationObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1417](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1417)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isSuccess`](MutationObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### mutate
|
||||
|
||||
```ts
|
||||
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1393](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1393)
|
||||
|
||||
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
|
||||
|
||||
#### Param
|
||||
|
||||
The variables object to pass to the `mutationFn`.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is successful and will be passed the mutation's result.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire if the mutation encounters an error and will be passed the error.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
|
||||
|
||||
#### Remarks
|
||||
|
||||
- If you make multiple requests, `onSuccess` will fire only after the latest call you've made.
|
||||
- All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`mutate`](MutationObserverBaseResult.md#mutate)
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset: () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1397](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1397)
|
||||
|
||||
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`reset`](MutationObserverBaseResult.md#reset)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "idle";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1418](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1418)
|
||||
|
||||
The status of the mutation.
|
||||
- Will be:
|
||||
- `idle` initial status prior to the mutation function executing.
|
||||
- `pending` if the mutation is currently executing.
|
||||
- `error` if the last mutation attempt resulted in an error.
|
||||
- `success` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`status`](MutationObserverBaseResult.md#status)
|
||||
|
||||
***
|
||||
|
||||
### submittedAt
|
||||
|
||||
```ts
|
||||
submittedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:74](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L74)
|
||||
|
||||
The timestamp for when the mutation was submitted.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`submittedAt`](MutationObserverBaseResult.md#submittedat)
|
||||
|
||||
***
|
||||
|
||||
### variables
|
||||
|
||||
```ts
|
||||
variables: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1412](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1412)
|
||||
|
||||
The variables object passed to the `mutationFn`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`variables`](MutationObserverBaseResult.md#variables)
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
id: MutationObserverLoadingResult
|
||||
title: MutationObserverLoadingResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1421](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1421)
|
||||
|
||||
The raw state stored on a `Mutation` instance. This is the underlying state
|
||||
that observer results (e.g. `MutationObserverResult`) are derived from.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`MutationObserverBaseResult`](MutationObserverBaseResult.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### context
|
||||
|
||||
```ts
|
||||
context: TOnMutateResult | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:40](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L40)
|
||||
|
||||
The value returned by `onMutate`, if defined. Passed to `onSuccess`,
|
||||
`onError` and `onSettled` as the mutation's context.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`context`](MutationObserverBaseResult.md#context)
|
||||
|
||||
***
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1432](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1432)
|
||||
|
||||
The last successfully resolved data for the mutation.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`data`](MutationObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1434](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1434)
|
||||
|
||||
The error object for the mutation, if an error was encountered.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`error`](MutationObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L53)
|
||||
|
||||
The number of times the mutation function has failed for the current attempt.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureCount`](MutationObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L57)
|
||||
|
||||
The reason the current attempt failed, as reported by the retryer.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureReason`](MutationObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1435](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1435)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isError`](MutationObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isIdle
|
||||
|
||||
```ts
|
||||
isIdle: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1436](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1436)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is in its initial state prior to executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isIdle`](MutationObserverBaseResult.md#isidle)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L62)
|
||||
|
||||
Whether the mutation is currently paused (see network mode), or is
|
||||
waiting for another mutation with the same `scope` to finish.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPaused`](MutationObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1437](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1437)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is currently executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPending`](MutationObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1438](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1438)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isSuccess`](MutationObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### mutate
|
||||
|
||||
```ts
|
||||
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1393](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1393)
|
||||
|
||||
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
|
||||
|
||||
#### Param
|
||||
|
||||
The variables object to pass to the `mutationFn`.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is successful and will be passed the mutation's result.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire if the mutation encounters an error and will be passed the error.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
|
||||
|
||||
#### Remarks
|
||||
|
||||
- If you make multiple requests, `onSuccess` will fire only after the latest call you've made.
|
||||
- All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`mutate`](MutationObserverBaseResult.md#mutate)
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset: () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1397](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1397)
|
||||
|
||||
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`reset`](MutationObserverBaseResult.md#reset)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "pending";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1439](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1439)
|
||||
|
||||
The status of the mutation.
|
||||
- Will be:
|
||||
- `idle` initial status prior to the mutation function executing.
|
||||
- `pending` if the mutation is currently executing.
|
||||
- `error` if the last mutation attempt resulted in an error.
|
||||
- `success` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`status`](MutationObserverBaseResult.md#status)
|
||||
|
||||
***
|
||||
|
||||
### submittedAt
|
||||
|
||||
```ts
|
||||
submittedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:74](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L74)
|
||||
|
||||
The timestamp for when the mutation was submitted.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`submittedAt`](MutationObserverBaseResult.md#submittedat)
|
||||
|
||||
***
|
||||
|
||||
### variables
|
||||
|
||||
```ts
|
||||
variables: TVariables;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1433](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1433)
|
||||
|
||||
The variables object passed to the `mutationFn`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`variables`](MutationObserverBaseResult.md#variables)
|
||||
@@ -0,0 +1,322 @@
|
||||
---
|
||||
id: MutationObserverOptions
|
||||
title: MutationObserverOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1267](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1267)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`MutationOptions`](MutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### gcTime?
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1260](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1260)
|
||||
|
||||
The time in milliseconds that an unused/inactive mutation remains in memory before it is
|
||||
garbage collected.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`gcTime`](MutationOptions.md#gctime)
|
||||
|
||||
***
|
||||
|
||||
### meta?
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1263](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1263)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`meta`](MutationOptions.md#meta)
|
||||
|
||||
***
|
||||
|
||||
### mutationFn?
|
||||
|
||||
```ts
|
||||
optional mutationFn: MutationFunction<TData, TVariables>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1206](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1206)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`mutationFn`](MutationOptions.md#mutationfn)
|
||||
|
||||
***
|
||||
|
||||
### mutationKey?
|
||||
|
||||
```ts
|
||||
optional mutationKey: readonly unknown[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1207](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1207)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`mutationKey`](MutationOptions.md#mutationkey)
|
||||
|
||||
***
|
||||
|
||||
### networkMode?
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1253](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1253)
|
||||
|
||||
Controls whether a mutation is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`networkMode`](MutationOptions.md#networkmode)
|
||||
|
||||
***
|
||||
|
||||
### onError()?
|
||||
|
||||
```ts
|
||||
optional onError: (error, variables, onMutateResult, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1218](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1218)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### error
|
||||
|
||||
`TError`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`onError`](MutationOptions.md#onerror)
|
||||
|
||||
***
|
||||
|
||||
### onMutate()?
|
||||
|
||||
```ts
|
||||
optional onMutate: (variables, context) => TOnMutateResult | Promise<TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1208](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1208)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`TOnMutateResult` \| `Promise`\<`TOnMutateResult`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`onMutate`](MutationOptions.md#onmutate)
|
||||
|
||||
***
|
||||
|
||||
### onSettled()?
|
||||
|
||||
```ts
|
||||
optional onSettled: (data, error, variables, onMutateResult, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1224](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1224)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TData` | `undefined`
|
||||
|
||||
##### error
|
||||
|
||||
`TError` | `null`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`onSettled`](MutationOptions.md#onsettled)
|
||||
|
||||
***
|
||||
|
||||
### onSuccess()?
|
||||
|
||||
```ts
|
||||
optional onSuccess: (data, variables, onMutateResult, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1212](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1212)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TData`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`onSuccess`](MutationOptions.md#onsuccess)
|
||||
|
||||
***
|
||||
|
||||
### retry?
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1239](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1239)
|
||||
|
||||
If `false`, failed mutations will not retry by default.
|
||||
If `true`, failed mutations will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed mutations will retry until the failed mutation count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed mutations will retry until the function returns false.
|
||||
|
||||
Defaults to `0`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`retry`](MutationOptions.md#retry)
|
||||
|
||||
***
|
||||
|
||||
### retryDelay?
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1246)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`retryDelay`](MutationOptions.md#retrydelay)
|
||||
|
||||
***
|
||||
|
||||
### scope?
|
||||
|
||||
```ts
|
||||
optional scope: MutationScope;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1264](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1264)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationOptions`](MutationOptions.md).[`scope`](MutationOptions.md#scope)
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean | (error) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1281](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1281)
|
||||
|
||||
Whether errors should be thrown instead of setting the `error` property.
|
||||
If set to `true`, all errors will be thrown to the nearest error boundary.
|
||||
If set to a function, it will be passed the error and should return a boolean indicating whether to throw the
|
||||
error (`true`) or return it as state (`false`).
|
||||
|
||||
Defaults to `false`.
|
||||
@@ -0,0 +1,308 @@
|
||||
---
|
||||
id: MutationObserverSuccessResult
|
||||
title: MutationObserverSuccessResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1463](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1463)
|
||||
|
||||
The raw state stored on a `Mutation` instance. This is the underlying state
|
||||
that observer results (e.g. `MutationObserverResult`) are derived from.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`MutationObserverBaseResult`](MutationObserverBaseResult.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### context
|
||||
|
||||
```ts
|
||||
context: TOnMutateResult | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:40](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L40)
|
||||
|
||||
The value returned by `onMutate`, if defined. Passed to `onSuccess`,
|
||||
`onError` and `onSettled` as the mutation's context.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`context`](MutationObserverBaseResult.md#context)
|
||||
|
||||
***
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1474](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1474)
|
||||
|
||||
The last successfully resolved data for the mutation.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`data`](MutationObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1475](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1475)
|
||||
|
||||
The error object for the mutation, if an error was encountered.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`error`](MutationObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L53)
|
||||
|
||||
The number of times the mutation function has failed for the current attempt.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureCount`](MutationObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L57)
|
||||
|
||||
The reason the current attempt failed, as reported by the retryer.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`failureReason`](MutationObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1477](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1477)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isError`](MutationObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isIdle
|
||||
|
||||
```ts
|
||||
isIdle: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1478](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1478)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is in its initial state prior to executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isIdle`](MutationObserverBaseResult.md#isidle)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L62)
|
||||
|
||||
Whether the mutation is currently paused (see network mode), or is
|
||||
waiting for another mutation with the same `scope` to finish.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPaused`](MutationObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1479](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1479)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the mutation is currently executing.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isPending`](MutationObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1480](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1480)
|
||||
|
||||
A boolean variable derived from `status`.
|
||||
- `true` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`isSuccess`](MutationObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### mutate
|
||||
|
||||
```ts
|
||||
mutate: MutateFunction<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1393](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1393)
|
||||
|
||||
The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options.
|
||||
|
||||
#### Param
|
||||
|
||||
The variables object to pass to the `mutationFn`.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is successful and will be passed the mutation's result.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire if the mutation encounters an error and will be passed the error.
|
||||
|
||||
#### Param
|
||||
|
||||
This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error.
|
||||
|
||||
#### Remarks
|
||||
|
||||
- If you make multiple requests, `onSuccess` will fire only after the latest call you've made.
|
||||
- All the callback functions (`onSuccess`, `onError`, `onSettled`) are void functions, and the returned value will be ignored.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`mutate`](MutationObserverBaseResult.md#mutate)
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset: () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1397](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1397)
|
||||
|
||||
A function to clean the mutation internal state (i.e., it resets the mutation to its initial state).
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`reset`](MutationObserverBaseResult.md#reset)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "success";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1481](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1481)
|
||||
|
||||
The status of the mutation.
|
||||
- Will be:
|
||||
- `idle` initial status prior to the mutation function executing.
|
||||
- `pending` if the mutation is currently executing.
|
||||
- `error` if the last mutation attempt resulted in an error.
|
||||
- `success` if the last mutation attempt was successful.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`status`](MutationObserverBaseResult.md#status)
|
||||
|
||||
***
|
||||
|
||||
### submittedAt
|
||||
|
||||
```ts
|
||||
submittedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:74](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L74)
|
||||
|
||||
The timestamp for when the mutation was submitted.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`submittedAt`](MutationObserverBaseResult.md#submittedat)
|
||||
|
||||
***
|
||||
|
||||
### variables
|
||||
|
||||
```ts
|
||||
variables: TVariables;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1476](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1476)
|
||||
|
||||
The variables object passed to the `mutationFn`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`MutationObserverBaseResult`](MutationObserverBaseResult.md).[`variables`](MutationObserverBaseResult.md#variables)
|
||||
257
docs/framework/lit/reference/interfaces/MutationOptions.md
Normal file
257
docs/framework/lit/reference/interfaces/MutationOptions.md
Normal file
@@ -0,0 +1,257 @@
|
||||
---
|
||||
id: MutationOptions
|
||||
title: MutationOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1200](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1200)
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`MutationObserverOptions`](MutationObserverOptions.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### gcTime?
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1260](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1260)
|
||||
|
||||
The time in milliseconds that an unused/inactive mutation remains in memory before it is
|
||||
garbage collected.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
***
|
||||
|
||||
### meta?
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1263](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1263)
|
||||
|
||||
***
|
||||
|
||||
### mutationFn?
|
||||
|
||||
```ts
|
||||
optional mutationFn: MutationFunction<TData, TVariables>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1206](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1206)
|
||||
|
||||
***
|
||||
|
||||
### mutationKey?
|
||||
|
||||
```ts
|
||||
optional mutationKey: readonly unknown[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1207](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1207)
|
||||
|
||||
***
|
||||
|
||||
### networkMode?
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1253](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1253)
|
||||
|
||||
Controls whether a mutation is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
***
|
||||
|
||||
### onError()?
|
||||
|
||||
```ts
|
||||
optional onError: (error, variables, onMutateResult, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1218](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1218)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### error
|
||||
|
||||
`TError`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### onMutate()?
|
||||
|
||||
```ts
|
||||
optional onMutate: (variables, context) => TOnMutateResult | Promise<TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1208](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1208)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`TOnMutateResult` \| `Promise`\<`TOnMutateResult`\>
|
||||
|
||||
***
|
||||
|
||||
### onSettled()?
|
||||
|
||||
```ts
|
||||
optional onSettled: (data, error, variables, onMutateResult, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1224](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1224)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TData` | `undefined`
|
||||
|
||||
##### error
|
||||
|
||||
`TError` | `null`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult` | `undefined`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### onSuccess()?
|
||||
|
||||
```ts
|
||||
optional onSuccess: (data, variables, onMutateResult, context) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1212](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1212)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TData`
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### onMutateResult
|
||||
|
||||
`TOnMutateResult`
|
||||
|
||||
##### context
|
||||
|
||||
[`MutationFunctionContext`](../type-aliases/MutationFunctionContext.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
***
|
||||
|
||||
### retry?
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1239](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1239)
|
||||
|
||||
If `false`, failed mutations will not retry by default.
|
||||
If `true`, failed mutations will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed mutations will retry until the failed mutation count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed mutations will retry until the function returns false.
|
||||
|
||||
Defaults to `0`.
|
||||
|
||||
***
|
||||
|
||||
### retryDelay?
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1246)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
***
|
||||
|
||||
### scope?
|
||||
|
||||
```ts
|
||||
optional scope: MutationScope;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1264](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1264)
|
||||
142
docs/framework/lit/reference/interfaces/MutationState.md
Normal file
142
docs/framework/lit/reference/interfaces/MutationState.md
Normal file
@@ -0,0 +1,142 @@
|
||||
---
|
||||
id: MutationState
|
||||
title: MutationState
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:30](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L30)
|
||||
|
||||
The raw state stored on a `Mutation` instance. This is the underlying state
|
||||
that observer results (e.g. `MutationObserverResult`) are derived from.
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`MutationObserverBaseResult`](MutationObserverBaseResult.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `unknown`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Properties
|
||||
|
||||
### context
|
||||
|
||||
```ts
|
||||
context: TOnMutateResult | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:40](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L40)
|
||||
|
||||
The value returned by `onMutate`, if defined. Passed to `onSuccess`,
|
||||
`onError` and `onSettled` as the mutation's context.
|
||||
|
||||
***
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:44](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L44)
|
||||
|
||||
The last successfully resolved data for the mutation.
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:49](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L49)
|
||||
|
||||
The error object for the mutation, if the last attempt resulted in an error.
|
||||
- Defaults to `null`.
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L53)
|
||||
|
||||
The number of times the mutation function has failed for the current attempt.
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L57)
|
||||
|
||||
The reason the current attempt failed, as reported by the retryer.
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:62](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L62)
|
||||
|
||||
Whether the mutation is currently paused (see network mode), or is
|
||||
waiting for another mutation with the same `scope` to finish.
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: MutationStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:66](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L66)
|
||||
|
||||
The status of the mutation.
|
||||
|
||||
***
|
||||
|
||||
### submittedAt
|
||||
|
||||
```ts
|
||||
submittedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:74](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L74)
|
||||
|
||||
The timestamp for when the mutation was submitted.
|
||||
|
||||
***
|
||||
|
||||
### variables
|
||||
|
||||
```ts
|
||||
variables: TVariables | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L70)
|
||||
|
||||
The variables the mutation was last called with.
|
||||
16
docs/framework/lit/reference/interfaces/NotifyEvent.md
Normal file
16
docs/framework/lit/reference/interfaces/NotifyEvent.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
id: NotifyEvent
|
||||
title: NotifyEvent
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1539](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1539)
|
||||
|
||||
## Properties
|
||||
|
||||
### type
|
||||
|
||||
```ts
|
||||
type: NotifyEventType;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1540](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1540)
|
||||
214
docs/framework/lit/reference/interfaces/OnlineManager.md
Normal file
214
docs/framework/lit/reference/interfaces/OnlineManager.md
Normal file
@@ -0,0 +1,214 @@
|
||||
---
|
||||
id: OnlineManager
|
||||
title: OnlineManager
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/onlineManager.ts:15](https://github.com/TanStack/query/blob/main/packages/query-core/src/onlineManager.ts#L15)
|
||||
|
||||
The `OnlineManager` manages the online state within TanStack Query. It can
|
||||
be used to change the default event listeners or to manually change the
|
||||
online state.
|
||||
|
||||
By default, the `onlineManager` assumes an active network connection, and
|
||||
listens to the `online` and `offline` events on the `window` object to
|
||||
detect changes.
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`Listener`\>
|
||||
|
||||
## Properties
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<Listener>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:2](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L2)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.listeners
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### hasListeners()
|
||||
|
||||
```ts
|
||||
hasListeners(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:19](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L19)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.hasListeners
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### isOnline()
|
||||
|
||||
```ts
|
||||
isOnline(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/onlineManager.ts:109](https://github.com/TanStack/query/blob/main/packages/query-core/src/onlineManager.ts#L109)
|
||||
|
||||
`isOnline` can be used to get the current online state.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/onlineManager.ts:44](https://github.com/TanStack/query/blob/main/packages/query-core/src/onlineManager.ts#L44)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/onlineManager.ts:50](https://github.com/TanStack/query/blob/main/packages/query-core/src/onlineManager.ts#L50)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setEventListener()
|
||||
|
||||
```ts
|
||||
setEventListener(setup): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/onlineManager.ts:75](https://github.com/TanStack/query/blob/main/packages/query-core/src/onlineManager.ts#L75)
|
||||
|
||||
`setEventListener` can be used to set a custom event listener that will
|
||||
be used to determine the online state. The provided `setup` function
|
||||
receives a `setOnline` callback that should be called with a `boolean`
|
||||
whenever the online state changes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### setup
|
||||
|
||||
`SetupFn`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import NetInfo from '@react-native-community/netinfo'
|
||||
import { onlineManager } from '@tanstack/query-core'
|
||||
|
||||
onlineManager.setEventListener((setOnline) => {
|
||||
return NetInfo.addEventListener((state) => {
|
||||
setOnline(!!state.isConnected)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setOnline()
|
||||
|
||||
```ts
|
||||
setOnline(online): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/onlineManager.ts:95](https://github.com/TanStack/query/blob/main/packages/query-core/src/onlineManager.ts#L95)
|
||||
|
||||
`setOnline` can be used to manually set the online state.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### online
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { onlineManager } from '@tanstack/query-core'
|
||||
|
||||
// Set to online
|
||||
onlineManager.setOnline(true)
|
||||
|
||||
// Set to offline
|
||||
onlineManager.setOnline(false)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### subscribe()
|
||||
|
||||
```ts
|
||||
subscribe(listener): () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:8](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L8)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### listener
|
||||
|
||||
`Listener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
id: QueriesObserverOptions
|
||||
title: QueriesObserverOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:23](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L23)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TCombinedResult
|
||||
|
||||
`TCombinedResult` = [`QueryObserverResult`](../type-aliases/QueryObserverResult.md)[]
|
||||
|
||||
## Properties
|
||||
|
||||
### combine?
|
||||
|
||||
```ts
|
||||
optional combine: CombineFn<TCombinedResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:34](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L34)
|
||||
|
||||
A function that combines the array of `QueryObserverResult`s (one per
|
||||
observed query) into a single value. The combined value is memoized and
|
||||
only recomputed when one of the underlying results, the query hashes, or
|
||||
the `combine` function itself changes.
|
||||
|
||||
Defaults to returning the array of `QueryObserverResult`s unchanged.
|
||||
93
docs/framework/lit/reference/interfaces/QueryCacheConfig.md
Normal file
93
docs/framework/lit/reference/interfaces/QueryCacheConfig.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
id: QueryCacheConfig
|
||||
title: QueryCacheConfig
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:25](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L25)
|
||||
|
||||
Global callbacks that fire for every query handled by a `QueryCache`, regardless of which
|
||||
component or observer triggered it. Unlike `QueryClient`'s `defaultOptions`, which a query can
|
||||
override, these callbacks are always called. Unlike `MutationCacheConfig`'s callbacks, these
|
||||
are fire-and-forget: their return value is not awaited before the query settles.
|
||||
|
||||
## Properties
|
||||
|
||||
### onError()?
|
||||
|
||||
```ts
|
||||
optional onError: (error, query) => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:27](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L27)
|
||||
|
||||
Called when any query in the cache encounters an error.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### error
|
||||
|
||||
`Error`
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### onSettled()?
|
||||
|
||||
```ts
|
||||
optional onSettled: (data, error, query) => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:34](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L34)
|
||||
|
||||
Called when any query in the cache is settled, either successfully or with an error.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`unknown`
|
||||
|
||||
##### error
|
||||
|
||||
`Error` | `null`
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### onSuccess()?
|
||||
|
||||
```ts
|
||||
optional onSuccess: (data, query) => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L32)
|
||||
|
||||
Called when any query in the cache is successful.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`unknown`
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)\<`unknown`, `unknown`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
43
docs/framework/lit/reference/interfaces/QueryClientConfig.md
Normal file
43
docs/framework/lit/reference/interfaces/QueryClientConfig.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: QueryClientConfig
|
||||
title: QueryClientConfig
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1495](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1495)
|
||||
|
||||
## Properties
|
||||
|
||||
### defaultOptions?
|
||||
|
||||
```ts
|
||||
optional defaultOptions: DefaultOptions<Error>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1504](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1504)
|
||||
|
||||
Default options for all queries and mutations created through this client.
|
||||
|
||||
***
|
||||
|
||||
### mutationCache?
|
||||
|
||||
```ts
|
||||
optional mutationCache: MutationCache;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1502](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1502)
|
||||
|
||||
The mutation cache this client is connected to. A new `MutationCache` is created if not
|
||||
provided.
|
||||
|
||||
***
|
||||
|
||||
### queryCache?
|
||||
|
||||
```ts
|
||||
optional queryCache: QueryCache;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1497](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1497)
|
||||
|
||||
The query cache this client is connected to. A new `QueryCache` is created if not provided.
|
||||
382
docs/framework/lit/reference/interfaces/QueryExecuteOptions.md
Normal file
382
docs/framework/lit/reference/interfaces/QueryExecuteOptions.md
Normal file
@@ -0,0 +1,382 @@
|
||||
---
|
||||
id: QueryExecuteOptions
|
||||
title: QueryExecuteOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:574](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L574)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`WithRequired`](../type-aliases/WithRequired.md)\<[`QueryOptions`](QueryOptions.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`, `TPageParam`\>, `"queryKey"`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
### TQueryData
|
||||
|
||||
`TQueryData` = `TQueryFnData`
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `never`
|
||||
|
||||
## Properties
|
||||
|
||||
### gcTime?
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L277)
|
||||
|
||||
The time in milliseconds that unused/inactive cache data remains in memory.
|
||||
When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.
|
||||
When different garbage collection times are specified, the longest one will be used.
|
||||
Setting it to `Infinity` will disable garbage collection.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
Note: the maximum allowed time is about 24 days, imposed by `setTimeout`'s 32-bit signed integer delay — see
|
||||
`timeoutManager.setTimeoutProvider` for a workaround.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.gcTime
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### initialData?
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| TQueryData
|
||||
| InitialDataFunction<TQueryData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:317](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L317)
|
||||
|
||||
If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
||||
created or cached yet).
|
||||
If set to a function, the function will be called **once** during the shared/root query initialization, and be
|
||||
expected to synchronously return the initial data.
|
||||
Initial data is considered stale by default unless a `staleTime` has been set.
|
||||
`initialData` **is persisted** to the cache.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.initialData
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### initialDataUpdatedAt?
|
||||
|
||||
```ts
|
||||
optional initialDataUpdatedAt: number | () => number | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L321)
|
||||
|
||||
If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.initialDataUpdatedAt
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### initialPageParam?
|
||||
|
||||
```ts
|
||||
optional initialPageParam: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:585](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L585)
|
||||
|
||||
***
|
||||
|
||||
### maxPages?
|
||||
|
||||
```ts
|
||||
optional maxPages: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:345](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L345)
|
||||
|
||||
Maximum number of pages to store in the data of an infinite query.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.maxPages
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### meta?
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:341](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L341)
|
||||
|
||||
Additional payload to be stored on each query.
|
||||
Use this property to pass information that can be used in other places.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.meta
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### networkMode?
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:265](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L265)
|
||||
|
||||
Controls whether a query is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.networkMode
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### persister?
|
||||
|
||||
```ts
|
||||
optional persister: QueryPersister<TQueryFnData, NoInfer<TQueryKey>, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L290)
|
||||
|
||||
This option can be used to persist the result of a query to an external storage, bypassing the need to actually
|
||||
call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.persister
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryFn?
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:285](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L285)
|
||||
|
||||
The function that the query will use to request data.
|
||||
Required, unless a default query function has been set via `queryClient.setQueryDefaults` or
|
||||
`queryClient.setDefaultOptions`.
|
||||
Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md).
|
||||
Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryFn
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryHash?
|
||||
|
||||
```ts
|
||||
optional queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:295](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L295)
|
||||
|
||||
The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used
|
||||
as the actual cache key internally.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryHash
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryKey
|
||||
|
||||
```ts
|
||||
queryKey: TQueryKey & object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:304](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L304)
|
||||
|
||||
The query key to use for this query.
|
||||
|
||||
The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys)
|
||||
for more information.
|
||||
|
||||
The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryKey
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryKeyHashFn?
|
||||
|
||||
```ts
|
||||
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L308)
|
||||
|
||||
If specified, this function is used to hash the `queryKey` to a string.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryKeyHashFn
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### retry?
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L246)
|
||||
|
||||
If `false`, failed queries will not retry by default.
|
||||
If `true`, failed queries will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
|
||||
|
||||
Defaults to `3` on the client and `0` on the server.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.retry
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### retryDelay?
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:258](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L258)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential
|
||||
backoff.
|
||||
|
||||
A function like `attempt => attempt * 1000` applies linear backoff.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.retryDelay
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### select()?
|
||||
|
||||
```ts
|
||||
optional select: (data) => TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:586](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L586)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TQueryData`
|
||||
|
||||
#### Returns
|
||||
|
||||
`TData`
|
||||
|
||||
***
|
||||
|
||||
### staleTime?
|
||||
|
||||
```ts
|
||||
optional staleTime: StaleTimeFunction<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:591](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L591)
|
||||
|
||||
The time in milliseconds after data is considered stale.
|
||||
If the data is fresh it will be returned from the cache.
|
||||
|
||||
***
|
||||
|
||||
### structuralSharing?
|
||||
|
||||
```ts
|
||||
optional structuralSharing: boolean | (oldData, newData) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330)
|
||||
|
||||
Set this to `false` to disable structural sharing between query results.
|
||||
Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.structuralSharing
|
||||
```
|
||||
104
docs/framework/lit/reference/interfaces/QueryFilters.md
Normal file
104
docs/framework/lit/reference/interfaces/QueryFilters.md
Normal file
@@ -0,0 +1,104 @@
|
||||
---
|
||||
id: QueryFilters
|
||||
title: QueryFilters
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:31](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L31)
|
||||
|
||||
Filters used to select queries, for example in `queryClient.getQueriesData` or `queryClient.invalidateQueries`.
|
||||
All provided filters must match; filters that are left unspecified are ignored.
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InvalidateQueryFilters`](InvalidateQueryFilters.md)
|
||||
- [`RefetchQueryFilters`](RefetchQueryFilters.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### exact?
|
||||
|
||||
```ts
|
||||
optional exact: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:41](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L41)
|
||||
|
||||
Match query key exactly
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus?
|
||||
|
||||
```ts
|
||||
optional fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L57)
|
||||
|
||||
Include queries matching their fetchStatus
|
||||
|
||||
***
|
||||
|
||||
### predicate()?
|
||||
|
||||
```ts
|
||||
optional predicate: (query) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:45](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L45)
|
||||
|
||||
Include queries matching this predicate function
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### queryKey?
|
||||
|
||||
```ts
|
||||
optional queryKey: TQueryKey | TuplePrefixes<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:49](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L49)
|
||||
|
||||
Include queries matching this query key
|
||||
|
||||
***
|
||||
|
||||
### stale?
|
||||
|
||||
```ts
|
||||
optional stale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L53)
|
||||
|
||||
Include or exclude stale queries
|
||||
|
||||
***
|
||||
|
||||
### type?
|
||||
|
||||
```ts
|
||||
optional type: QueryTypeFilter;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:37](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L37)
|
||||
|
||||
Filter to active queries, inactive queries or all queries
|
||||
|
||||
Defaults to `'all'`.
|
||||
@@ -0,0 +1,358 @@
|
||||
---
|
||||
id: QueryObserverBaseResult
|
||||
title: QueryObserverBaseResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:764](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L764)
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`QueryObserverPendingResult`](QueryObserverPendingResult.md)
|
||||
- [`QueryObserverLoadingResult`](QueryObserverLoadingResult.md)
|
||||
- [`QueryObserverLoadingErrorResult`](QueryObserverLoadingErrorResult.md)
|
||||
- [`QueryObserverRefetchErrorResult`](QueryObserverRefetchErrorResult.md)
|
||||
- [`QueryObserverSuccessResult`](QueryObserverSuccessResult.md)
|
||||
- [`QueryObserverPlaceholderResult`](QueryObserverPlaceholderResult.md)
|
||||
- [`InfiniteQueryObserverBaseResult`](InfiniteQueryObserverBaseResult.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:771](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L771)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:780](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L780)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:804](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L804)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:823](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L823)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:831](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L831)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:827](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L827)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:845](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L845)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:849](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L849)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:863](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L863)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: QueryStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:881](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L881)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
@@ -0,0 +1,452 @@
|
||||
---
|
||||
id: QueryObserverLoadingErrorResult
|
||||
title: QueryObserverLoadingErrorResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:923](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L923)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:927](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L927)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:928](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L928)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:929](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L929)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:931](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L931)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:932](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L932)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:930](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L930)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:935](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L935)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:933](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L933)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:934](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L934)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "error";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:936](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L936)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,452 @@
|
||||
---
|
||||
id: QueryObserverLoadingResult
|
||||
title: QueryObserverLoadingResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:907](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L907)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:911](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L911)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:912](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L912)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:913](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L913)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:915](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L915)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:916](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L916)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:914](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L914)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:919](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L919)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:917](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L917)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:918](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L918)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "pending";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:920](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L920)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
560
docs/framework/lit/reference/interfaces/QueryObserverOptions.md
Normal file
560
docs/framework/lit/reference/interfaces/QueryObserverOptions.md
Normal file
@@ -0,0 +1,560 @@
|
||||
---
|
||||
id: QueryObserverOptions
|
||||
title: QueryObserverOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:380](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L380)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`WithRequired`](../type-aliases/WithRequired.md)\<[`QueryOptions`](QueryOptions.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`, `TPageParam`\>, `"queryKey"`\>
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InfiniteQueryObserverOptions`](InfiniteQueryObserverOptions.md)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
### TQueryData
|
||||
|
||||
`TQueryData` = `TQueryFnData`
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `never`
|
||||
|
||||
## Properties
|
||||
|
||||
### enabled?
|
||||
|
||||
```ts
|
||||
optional enabled: QueryBooleanOption<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:398](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L398)
|
||||
|
||||
Set this to `false` or a function that returns `false` to disable automatic refetching when the query mounts or changes query keys.
|
||||
To refetch the query, use the `refetch` method returned from the `useQuery` instance.
|
||||
Accepts a boolean or function that returns a boolean.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### gcTime?
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L277)
|
||||
|
||||
The time in milliseconds that unused/inactive cache data remains in memory.
|
||||
When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.
|
||||
When different garbage collection times are specified, the longest one will be used.
|
||||
Setting it to `Infinity` will disable garbage collection.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
Note: the maximum allowed time is about 24 days, imposed by `setTimeout`'s 32-bit signed integer delay — see
|
||||
`timeoutManager.setTimeoutProvider` for a workaround.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.gcTime
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### initialData?
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| TQueryData
|
||||
| InitialDataFunction<TQueryData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:317](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L317)
|
||||
|
||||
If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
||||
created or cached yet).
|
||||
If set to a function, the function will be called **once** during the shared/root query initialization, and be
|
||||
expected to synchronously return the initial data.
|
||||
Initial data is considered stale by default unless a `staleTime` has been set.
|
||||
`initialData` **is persisted** to the cache.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.initialData
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### initialDataUpdatedAt?
|
||||
|
||||
```ts
|
||||
optional initialDataUpdatedAt: number | () => number | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L321)
|
||||
|
||||
If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.initialDataUpdatedAt
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### maxPages?
|
||||
|
||||
```ts
|
||||
optional maxPages: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:345](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L345)
|
||||
|
||||
Maximum number of pages to store in the data of an infinite query.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.maxPages
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### meta?
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:341](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L341)
|
||||
|
||||
Additional payload to be stored on each query.
|
||||
Use this property to pass information that can be used in other places.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.meta
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### networkMode?
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:265](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L265)
|
||||
|
||||
Controls whether a query is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.networkMode
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### notifyOnChangeProps?
|
||||
|
||||
```ts
|
||||
optional notifyOnChangeProps: NotifyOnChangeProps;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:484](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L484)
|
||||
|
||||
If set, the component will only re-render if any of the listed properties change.
|
||||
When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change.
|
||||
When set to `'all'`, the component will re-render whenever a query is updated.
|
||||
When set to a function, the function will be executed to compute the list of properties.
|
||||
|
||||
Defaults to `undefined`, in which case property access is tracked automatically, and the
|
||||
component only re-renders when one of the tracked properties changes.
|
||||
|
||||
***
|
||||
|
||||
### persister?
|
||||
|
||||
```ts
|
||||
optional persister: QueryPersister<TQueryFnData, NoInfer<TQueryKey>, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L290)
|
||||
|
||||
This option can be used to persist the result of a query to an external storage, bypassing the need to actually
|
||||
call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.persister
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### placeholderData?
|
||||
|
||||
```ts
|
||||
optional placeholderData:
|
||||
| NonFunctionGuard<TQueryData>
|
||||
| PlaceholderDataFunction<NonFunctionGuard<TQueryData>, TError, NonFunctionGuard<TQueryData>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:511](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L511)
|
||||
|
||||
If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided.
|
||||
|
||||
***
|
||||
|
||||
### queryFn?
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:285](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L285)
|
||||
|
||||
The function that the query will use to request data.
|
||||
Required, unless a default query function has been set via `queryClient.setQueryDefaults` or
|
||||
`queryClient.setDefaultOptions`.
|
||||
Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md).
|
||||
Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryFn
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryHash?
|
||||
|
||||
```ts
|
||||
optional queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:295](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L295)
|
||||
|
||||
The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used
|
||||
as the actual cache key internally.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryHash
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryKey
|
||||
|
||||
```ts
|
||||
queryKey: TQueryKey & object;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:304](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L304)
|
||||
|
||||
The query key to use for this query.
|
||||
|
||||
The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys)
|
||||
for more information.
|
||||
|
||||
The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryKey
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryKeyHashFn?
|
||||
|
||||
```ts
|
||||
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L308)
|
||||
|
||||
If specified, this function is used to hash the `queryKey` to a string.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.queryKeyHashFn
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### refetchInterval?
|
||||
|
||||
```ts
|
||||
optional refetchInterval: number | false | (query) => number | false | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:414](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L414)
|
||||
|
||||
If set to a number, the query will continuously refetch at this frequency in milliseconds.
|
||||
If set to a function, the function will be executed with the latest data and query to compute a frequency
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
***
|
||||
|
||||
### refetchIntervalInBackground?
|
||||
|
||||
```ts
|
||||
optional refetchIntervalInBackground: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:425](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L425)
|
||||
|
||||
If set to `true`, the query will continue to refetch while their tab/window is in the background.
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
***
|
||||
|
||||
### refetchOnMount?
|
||||
|
||||
```ts
|
||||
optional refetchOnMount: boolean | "always" | (query) => boolean | "always";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:462](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L462)
|
||||
|
||||
If set to `true`, the query will refetch on mount if the data is stale.
|
||||
If set to `false`, will disable additional instances of a query to trigger background refetch.
|
||||
If set to `'always'`, the query will always refetch on mount (except when `staleTime: 'static'` is used).
|
||||
If set to a function, the function will be executed with the latest data and query to compute the value
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### refetchOnReconnect?
|
||||
|
||||
```ts
|
||||
optional refetchOnReconnect: boolean | "always" | (query) => boolean | "always";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:448](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L448)
|
||||
|
||||
If set to `true`, the query will refetch on reconnect if the data is stale.
|
||||
If set to `false`, the query will not refetch on reconnect.
|
||||
If set to `'always'`, the query will always refetch on reconnect (except when `staleTime: 'static'` is used).
|
||||
If set to a function, the function will be executed with the latest data and query to compute the value.
|
||||
|
||||
Defaults to `true` unless `networkMode` is `'always'`.
|
||||
|
||||
***
|
||||
|
||||
### refetchOnWindowFocus?
|
||||
|
||||
```ts
|
||||
optional refetchOnWindowFocus: boolean | "always" | (query) => boolean | "always";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:434](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L434)
|
||||
|
||||
If set to `true`, the query will refetch on window focus if the data is stale.
|
||||
If set to `false`, the query will not refetch on window focus.
|
||||
If set to `'always'`, the query will always refetch on window focus (except when `staleTime: 'static'` is used).
|
||||
If set to a function, the function will be executed with the latest data and query to compute the value.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### retry?
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L246)
|
||||
|
||||
If `false`, failed queries will not retry by default.
|
||||
If `true`, failed queries will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
|
||||
|
||||
Defaults to `3` on the client and `0` on the server.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.retry
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### retryDelay?
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:258](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L258)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential
|
||||
backoff.
|
||||
|
||||
A function like `attempt => attempt * 1000` applies linear backoff.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.retryDelay
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### retryOnMount?
|
||||
|
||||
```ts
|
||||
optional retryOnMount: QueryBooleanOption<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:474](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L474)
|
||||
|
||||
If set to `false`, the query will not be retried on mount if it contains an error.
|
||||
If set to a function, the function will be executed with the query to compute the value.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### select()?
|
||||
|
||||
```ts
|
||||
optional select: (data) => TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:500](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L500)
|
||||
|
||||
This option can be used to transform or select a part of the data returned by the query function. It affects
|
||||
the returned `data` value, but does not affect what gets stored in the query cache.
|
||||
The `select` function will only run if `data` changed, or if the reference to the `select` function itself
|
||||
changes. To optimize, memoize the function so its reference stays stable across calls.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### data
|
||||
|
||||
`TQueryData`
|
||||
|
||||
#### Returns
|
||||
|
||||
`TData`
|
||||
|
||||
***
|
||||
|
||||
### staleTime?
|
||||
|
||||
```ts
|
||||
optional staleTime: StaleTimeFunction<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:407](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L407)
|
||||
|
||||
The time in milliseconds after data is considered stale.
|
||||
If set to `Infinity`, the data will never be considered stale.
|
||||
If set to `'static'`, the data will never be considered stale.
|
||||
If set to a function, the function will be executed with the query to compute a `staleTime`.
|
||||
|
||||
Defaults to `0`.
|
||||
|
||||
***
|
||||
|
||||
### structuralSharing?
|
||||
|
||||
```ts
|
||||
optional structuralSharing: boolean | (oldData, newData) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330)
|
||||
|
||||
Set this to `false` to disable structural sharing between query results.
|
||||
Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
WithRequired.structuralSharing
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### suspense?
|
||||
|
||||
```ts
|
||||
optional suspense: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:507](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L507)
|
||||
|
||||
If set to `true`, the query will suspend when `status === 'pending'`
|
||||
and throw errors when `status === 'error'`.
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:493](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L493)
|
||||
|
||||
Whether errors should be thrown instead of setting the `error` property.
|
||||
If set to `true` or `suspense` is `true`, all errors will be thrown to the error boundary.
|
||||
If set to `false` and `suspense` is `false`, errors are returned as state.
|
||||
If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (`true`) or return the error as state (`false`).
|
||||
|
||||
Defaults to `false`.
|
||||
@@ -0,0 +1,452 @@
|
||||
---
|
||||
id: QueryObserverPendingResult
|
||||
title: QueryObserverPendingResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:892](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L892)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:896](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L896)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:897](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L897)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:898](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L898)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:823](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L823)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:900](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L900)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:899](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L899)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:903](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L903)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:901](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L901)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:902](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L902)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "pending";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:904](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L904)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,452 @@
|
||||
---
|
||||
id: QueryObserverPlaceholderResult
|
||||
title: QueryObserverPlaceholderResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:971](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L971)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:975](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L975)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:977](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L977)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:976](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L976)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:979](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L979)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:980](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L980)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:978](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L978)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:983](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L983)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:981](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L981)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:982](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L982)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "success";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:984](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L984)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,452 @@
|
||||
---
|
||||
id: QueryObserverRefetchErrorResult
|
||||
title: QueryObserverRefetchErrorResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:939](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L939)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:943](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L943)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:944](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L944)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:945](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L945)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:947](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L947)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:948](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L948)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:946](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L946)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:951](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L951)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:949](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L949)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:950](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L950)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "error";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:952](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L952)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
@@ -0,0 +1,452 @@
|
||||
---
|
||||
id: QueryObserverSuccessResult
|
||||
title: QueryObserverSuccessResult
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:955](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L955)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:959](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L959)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#data)
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:775](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L775)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`dataUpdatedAt`](QueryObserverBaseResult.md#dataupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:960](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L960)
|
||||
|
||||
The error object for the query, if an error was thrown.
|
||||
- Defaults to `null`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#error)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:799](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L799)
|
||||
|
||||
The sum of all errors.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdateCount`](QueryObserverBaseResult.md#errorupdatecount)
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:784](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L784)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`errorUpdatedAt`](QueryObserverBaseResult.md#errorupdatedat)
|
||||
|
||||
***
|
||||
|
||||
### failureCount
|
||||
|
||||
```ts
|
||||
failureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:790](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L790)
|
||||
|
||||
The failure count for the query.
|
||||
- Incremented every time the query fails.
|
||||
- Reset to `0` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureCount`](QueryObserverBaseResult.md#failurecount)
|
||||
|
||||
***
|
||||
|
||||
### failureReason
|
||||
|
||||
```ts
|
||||
failureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:795](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L795)
|
||||
|
||||
The failure reason for the query retry.
|
||||
- Reset to `null` when the query succeeds.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`failureReason`](QueryObserverBaseResult.md#failurereason)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:889](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L889)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetch.
|
||||
- `paused`: The query wanted to fetch, but has been `paused`.
|
||||
- `idle`: The query is not fetching.
|
||||
- See [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`fetchStatus`](QueryObserverBaseResult.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### isEnabled
|
||||
|
||||
```ts
|
||||
isEnabled: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:867](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L867)
|
||||
|
||||
`true` if this observer is enabled, `false` otherwise.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isEnabled`](QueryObserverBaseResult.md#isenabled)
|
||||
|
||||
***
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:961](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L961)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query attempt resulted in an error.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#iserror)
|
||||
|
||||
***
|
||||
|
||||
### isFetched
|
||||
|
||||
```ts
|
||||
isFetched: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:808](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L808)
|
||||
|
||||
Will be `true` if the query has been fetched.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetched`](QueryObserverBaseResult.md#isfetched)
|
||||
|
||||
***
|
||||
|
||||
### isFetchedAfterMount
|
||||
|
||||
```ts
|
||||
isFetchedAfterMount: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:813](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L813)
|
||||
|
||||
Will be `true` if the query has been fetched after the component mounted.
|
||||
- This property can be used to not show any previously cached data.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetchedAfterMount`](QueryObserverBaseResult.md#isfetchedaftermount)
|
||||
|
||||
***
|
||||
|
||||
### isFetching
|
||||
|
||||
```ts
|
||||
isFetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:818](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L818)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- `true` whenever the `queryFn` is executing, which includes initial `pending` as well as background refetch.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isFetching`](QueryObserverBaseResult.md#isfetching)
|
||||
|
||||
***
|
||||
|
||||
### ~~isInitialLoading~~
|
||||
|
||||
```ts
|
||||
isInitialLoading: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:836](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L836)
|
||||
|
||||
#### Deprecated
|
||||
|
||||
`isInitialLoading` is being deprecated in favor of `isLoading`
|
||||
and will be removed in the next major version.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isInitialLoading`](QueryObserverBaseResult.md#isinitialloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoading
|
||||
|
||||
```ts
|
||||
isLoading: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:963](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L963)
|
||||
|
||||
Is `true` whenever the first fetch for a query is in-flight.
|
||||
- Is the same as `isFetching && isPending`.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#isloading)
|
||||
|
||||
***
|
||||
|
||||
### isLoadingError
|
||||
|
||||
```ts
|
||||
isLoadingError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:964](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L964)
|
||||
|
||||
Will be `true` if the query failed while fetching for the first time.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#isloadingerror)
|
||||
|
||||
***
|
||||
|
||||
### isPaused
|
||||
|
||||
```ts
|
||||
isPaused: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:841](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L841)
|
||||
|
||||
A derived boolean from the `fetchStatus` variable, provided for convenience.
|
||||
- The query wanted to fetch, but has been `paused`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPaused`](QueryObserverBaseResult.md#ispaused)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:962](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L962)
|
||||
|
||||
Will be `pending` if there's no cached data and no query attempt was finished yet.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#ispending)
|
||||
|
||||
***
|
||||
|
||||
### isPlaceholderData
|
||||
|
||||
```ts
|
||||
isPlaceholderData: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:967](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L967)
|
||||
|
||||
Will be `true` if the data shown is the placeholder data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#isplaceholderdata)
|
||||
|
||||
***
|
||||
|
||||
### isRefetchError
|
||||
|
||||
```ts
|
||||
isRefetchError: false;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:965](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L965)
|
||||
|
||||
Will be `true` if the query failed while refetching.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#isrefetcherror)
|
||||
|
||||
***
|
||||
|
||||
### isRefetching
|
||||
|
||||
```ts
|
||||
isRefetching: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:854](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L854)
|
||||
|
||||
Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`.
|
||||
- Is the same as `isFetching && !isPending`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetching`](QueryObserverBaseResult.md#isrefetching)
|
||||
|
||||
***
|
||||
|
||||
### isStale
|
||||
|
||||
```ts
|
||||
isStale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:858](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L858)
|
||||
|
||||
Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isStale`](QueryObserverBaseResult.md#isstale)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: true;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:966](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L966)
|
||||
|
||||
A derived boolean from the `status` variable, provided for convenience.
|
||||
- `true` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#issuccess)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch: (options?) => Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:871](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L871)
|
||||
|
||||
A function to manually refetch the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`refetch`](QueryObserverBaseResult.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: "success";
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:968](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L968)
|
||||
|
||||
The status of the query.
|
||||
- Will be:
|
||||
- `pending` if there's no cached data and no query attempt was finished yet.
|
||||
- `error` if the query attempt resulted in an error.
|
||||
- `success` if the query has received a response with no errors and is ready to display its data.
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#status)
|
||||
247
docs/framework/lit/reference/interfaces/QueryOptions.md
Normal file
247
docs/framework/lit/reference/interfaces/QueryOptions.md
Normal file
@@ -0,0 +1,247 @@
|
||||
---
|
||||
id: QueryOptions
|
||||
title: QueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:231](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L231)
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `never`
|
||||
|
||||
## Properties
|
||||
|
||||
### gcTime?
|
||||
|
||||
```ts
|
||||
optional gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L277)
|
||||
|
||||
The time in milliseconds that unused/inactive cache data remains in memory.
|
||||
When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration.
|
||||
When different garbage collection times are specified, the longest one will be used.
|
||||
Setting it to `Infinity` will disable garbage collection.
|
||||
|
||||
Defaults to `5 * 60 * 1000` (5 minutes), or `Infinity` during SSR.
|
||||
|
||||
Note: the maximum allowed time is about 24 days, imposed by `setTimeout`'s 32-bit signed integer delay — see
|
||||
`timeoutManager.setTimeoutProvider` for a workaround.
|
||||
|
||||
***
|
||||
|
||||
### initialData?
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| TData
|
||||
| InitialDataFunction<TData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:317](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L317)
|
||||
|
||||
If set, this value will be used as the initial data for the query cache (as long as the query hasn't been
|
||||
created or cached yet).
|
||||
If set to a function, the function will be called **once** during the shared/root query initialization, and be
|
||||
expected to synchronously return the initial data.
|
||||
Initial data is considered stale by default unless a `staleTime` has been set.
|
||||
`initialData` **is persisted** to the cache.
|
||||
|
||||
***
|
||||
|
||||
### initialDataUpdatedAt?
|
||||
|
||||
```ts
|
||||
optional initialDataUpdatedAt: number | () => number | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L321)
|
||||
|
||||
If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated.
|
||||
|
||||
***
|
||||
|
||||
### maxPages?
|
||||
|
||||
```ts
|
||||
optional maxPages: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:345](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L345)
|
||||
|
||||
Maximum number of pages to store in the data of an infinite query.
|
||||
|
||||
***
|
||||
|
||||
### meta?
|
||||
|
||||
```ts
|
||||
optional meta: Record<string, unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:341](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L341)
|
||||
|
||||
Additional payload to be stored on each query.
|
||||
Use this property to pass information that can be used in other places.
|
||||
|
||||
***
|
||||
|
||||
### networkMode?
|
||||
|
||||
```ts
|
||||
optional networkMode: NetworkMode;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:265](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L265)
|
||||
|
||||
Controls whether a query is allowed to run based on the current network connectivity.
|
||||
|
||||
Defaults to `'online'`.
|
||||
|
||||
#### See
|
||||
|
||||
[Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information.
|
||||
|
||||
***
|
||||
|
||||
### persister?
|
||||
|
||||
```ts
|
||||
optional persister: QueryPersister<TQueryFnData, NoInfer<TQueryKey>, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:290](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L290)
|
||||
|
||||
This option can be used to persist the result of a query to an external storage, bypassing the need to actually
|
||||
call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries.
|
||||
|
||||
***
|
||||
|
||||
### queryFn?
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>
|
||||
| typeof skipToken;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:285](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L285)
|
||||
|
||||
The function that the query will use to request data.
|
||||
Required, unless a default query function has been set via `queryClient.setQueryDefaults` or
|
||||
`queryClient.setDefaultOptions`.
|
||||
Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md).
|
||||
Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`.
|
||||
|
||||
***
|
||||
|
||||
### queryHash?
|
||||
|
||||
```ts
|
||||
optional queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:295](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L295)
|
||||
|
||||
The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used
|
||||
as the actual cache key internally.
|
||||
|
||||
***
|
||||
|
||||
### queryKey?
|
||||
|
||||
```ts
|
||||
optional queryKey: TQueryKey;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:304](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L304)
|
||||
|
||||
The query key to use for this query.
|
||||
|
||||
The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys)
|
||||
for more information.
|
||||
|
||||
The query will automatically update when this key changes (as long as `enabled` is not set to `false`).
|
||||
|
||||
***
|
||||
|
||||
### queryKeyHashFn?
|
||||
|
||||
```ts
|
||||
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L308)
|
||||
|
||||
If specified, this function is used to hash the `queryKey` to a string.
|
||||
|
||||
***
|
||||
|
||||
### retry?
|
||||
|
||||
```ts
|
||||
optional retry: RetryValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L246)
|
||||
|
||||
If `false`, failed queries will not retry by default.
|
||||
If `true`, failed queries will retry infinitely.
|
||||
If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number.
|
||||
If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false.
|
||||
|
||||
Defaults to `3` on the client and `0` on the server.
|
||||
|
||||
***
|
||||
|
||||
### retryDelay?
|
||||
|
||||
```ts
|
||||
optional retryDelay: RetryDelayValue<TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:258](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L258)
|
||||
|
||||
This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the
|
||||
next attempt in milliseconds.
|
||||
|
||||
A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential
|
||||
backoff.
|
||||
|
||||
A function like `attempt => attempt * 1000` applies linear backoff.
|
||||
|
||||
Defaults to a function that applies exponential backoff, capped at 30 seconds.
|
||||
|
||||
***
|
||||
|
||||
### structuralSharing?
|
||||
|
||||
```ts
|
||||
optional structuralSharing: boolean | (oldData, newData) => unknown;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330)
|
||||
|
||||
Set this to `false` to disable structural sharing between query results.
|
||||
Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
||||
|
||||
Defaults to `true`.
|
||||
175
docs/framework/lit/reference/interfaces/QueryState.md
Normal file
175
docs/framework/lit/reference/interfaces/QueryState.md
Normal file
@@ -0,0 +1,175 @@
|
||||
---
|
||||
id: QueryState
|
||||
title: QueryState
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:52](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L52)
|
||||
|
||||
The raw state stored on a `Query` instance. This is the underlying state
|
||||
that observer results (e.g. `QueryObserverResult`) are derived from.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### data
|
||||
|
||||
```ts
|
||||
data: TData | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:56](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L56)
|
||||
|
||||
The last successfully resolved data for the query.
|
||||
|
||||
***
|
||||
|
||||
### dataUpdateCount
|
||||
|
||||
```ts
|
||||
dataUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:60](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L60)
|
||||
|
||||
The number of times the query has successfully resolved.
|
||||
|
||||
***
|
||||
|
||||
### dataUpdatedAt
|
||||
|
||||
```ts
|
||||
dataUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:64](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L64)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"success"`.
|
||||
|
||||
***
|
||||
|
||||
### error
|
||||
|
||||
```ts
|
||||
error: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:69](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L69)
|
||||
|
||||
The error object for the query, if the last attempt resulted in an error.
|
||||
- Defaults to `null`.
|
||||
|
||||
***
|
||||
|
||||
### errorUpdateCount
|
||||
|
||||
```ts
|
||||
errorUpdateCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:73](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L73)
|
||||
|
||||
The sum of all errors, incremented every time the query resolves with an error.
|
||||
|
||||
***
|
||||
|
||||
### errorUpdatedAt
|
||||
|
||||
```ts
|
||||
errorUpdatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:77](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L77)
|
||||
|
||||
The timestamp for when the query most recently returned the `status` as `"error"`.
|
||||
|
||||
***
|
||||
|
||||
### fetchFailureCount
|
||||
|
||||
```ts
|
||||
fetchFailureCount: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L83)
|
||||
|
||||
The failure count for the current fetch.
|
||||
- Incremented every time the fetch fails.
|
||||
- Reset to `0` when the fetch succeeds.
|
||||
|
||||
***
|
||||
|
||||
### fetchFailureReason
|
||||
|
||||
```ts
|
||||
fetchFailureReason: TError | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:88](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L88)
|
||||
|
||||
The reason the current fetch failed, as reported by the retryer.
|
||||
- Reset to `null` when the fetch succeeds.
|
||||
|
||||
***
|
||||
|
||||
### fetchMeta
|
||||
|
||||
```ts
|
||||
fetchMeta: FetchMeta | null;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L93)
|
||||
|
||||
Metadata passed to the currently in-flight (or most recent) fetch, e.g. the
|
||||
`fetchMore` direction for infinite queries.
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus
|
||||
|
||||
```ts
|
||||
fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:112](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L112)
|
||||
|
||||
The fetch status of the query.
|
||||
- `fetching`: the `queryFn` is currently executing.
|
||||
- `paused`: a fetch wanted to run but has been paused (see network mode).
|
||||
- `idle`: the query is not fetching.
|
||||
|
||||
***
|
||||
|
||||
### isInvalidated
|
||||
|
||||
```ts
|
||||
isInvalidated: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:98](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L98)
|
||||
|
||||
Whether the query has been marked as invalidated via `invalidate()`.
|
||||
- Reset to `false` whenever the query resolves successfully.
|
||||
|
||||
***
|
||||
|
||||
### status
|
||||
|
||||
```ts
|
||||
status: QueryStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:105](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L105)
|
||||
|
||||
The status of the query.
|
||||
- `pending` if there's no cached data and no attempt was finished yet.
|
||||
- `error` if the last attempt resulted in an error.
|
||||
- `success` if the query has data.
|
||||
50
docs/framework/lit/reference/interfaces/RefetchOptions.md
Normal file
50
docs/framework/lit/reference/interfaces/RefetchOptions.md
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
id: RefetchOptions
|
||||
title: RefetchOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:704](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L704)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`ResultOptions`](ResultOptions.md)
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InvalidateOptions`](InvalidateOptions.md)
|
||||
- [`ResetOptions`](ResetOptions.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### cancelRefetch?
|
||||
|
||||
```ts
|
||||
optional cancelRefetch: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:712](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L712)
|
||||
|
||||
If set to `true`, a currently running request will be cancelled before a new request is made
|
||||
|
||||
If set to `false`, no refetch will be made if there is already a request running.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:701](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L701)
|
||||
|
||||
If set to `true`, the method throws if any of the underlying query refetch tasks fail.
|
||||
|
||||
Defaults to `false`, in which case failed refetches are swallowed and not surfaced to the
|
||||
caller.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`ResultOptions`](ResultOptions.md).[`throwOnError`](ResultOptions.md#throwonerror)
|
||||
127
docs/framework/lit/reference/interfaces/RefetchQueryFilters.md
Normal file
127
docs/framework/lit/reference/interfaces/RefetchQueryFilters.md
Normal file
@@ -0,0 +1,127 @@
|
||||
---
|
||||
id: RefetchQueryFilters
|
||||
title: RefetchQueryFilters
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:730](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L730)
|
||||
|
||||
Filters used to select queries, for example in `queryClient.getQueriesData` or `queryClient.invalidateQueries`.
|
||||
All provided filters must match; filters that are left unspecified are ignored.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryFilters`](QueryFilters.md)\<`TQueryKey`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### exact?
|
||||
|
||||
```ts
|
||||
optional exact: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:41](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L41)
|
||||
|
||||
Match query key exactly
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`exact`](QueryFilters.md#exact)
|
||||
|
||||
***
|
||||
|
||||
### fetchStatus?
|
||||
|
||||
```ts
|
||||
optional fetchStatus: FetchStatus;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L57)
|
||||
|
||||
Include queries matching their fetchStatus
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`fetchStatus`](QueryFilters.md#fetchstatus)
|
||||
|
||||
***
|
||||
|
||||
### predicate()?
|
||||
|
||||
```ts
|
||||
optional predicate: (query) => boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:45](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L45)
|
||||
|
||||
Include queries matching this predicate function
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`predicate`](QueryFilters.md#predicate)
|
||||
|
||||
***
|
||||
|
||||
### queryKey?
|
||||
|
||||
```ts
|
||||
optional queryKey: TQueryKey | TuplePrefixes<TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:49](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L49)
|
||||
|
||||
Include queries matching this query key
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`queryKey`](QueryFilters.md#querykey)
|
||||
|
||||
***
|
||||
|
||||
### stale?
|
||||
|
||||
```ts
|
||||
optional stale: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:53](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L53)
|
||||
|
||||
Include or exclude stale queries
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`stale`](QueryFilters.md#stale)
|
||||
|
||||
***
|
||||
|
||||
### type?
|
||||
|
||||
```ts
|
||||
optional type: QueryTypeFilter;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:37](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L37)
|
||||
|
||||
Filter to active queries, inactive queries or all queries
|
||||
|
||||
Defaults to `'all'`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryFilters`](QueryFilters.md).[`type`](QueryFilters.md#type)
|
||||
6
docs/framework/lit/reference/interfaces/Register.md
Normal file
6
docs/framework/lit/reference/interfaces/Register.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
id: Register
|
||||
title: Register
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:37](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L37)
|
||||
49
docs/framework/lit/reference/interfaces/ResetOptions.md
Normal file
49
docs/framework/lit/reference/interfaces/ResetOptions.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
id: ResetOptions
|
||||
title: ResetOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:735](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L735)
|
||||
|
||||
## Extends
|
||||
|
||||
- [`RefetchOptions`](RefetchOptions.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### cancelRefetch?
|
||||
|
||||
```ts
|
||||
optional cancelRefetch: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:712](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L712)
|
||||
|
||||
If set to `true`, a currently running request will be cancelled before a new request is made
|
||||
|
||||
If set to `false`, no refetch will be made if there is already a request running.
|
||||
|
||||
Defaults to `true`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md).[`cancelRefetch`](RefetchOptions.md#cancelrefetch)
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:701](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L701)
|
||||
|
||||
If set to `true`, the method throws if any of the underlying query refetch tasks fail.
|
||||
|
||||
Defaults to `false`, in which case failed refetches are swallowed and not surfaced to the
|
||||
caller.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`RefetchOptions`](RefetchOptions.md).[`throwOnError`](RefetchOptions.md#throwonerror)
|
||||
27
docs/framework/lit/reference/interfaces/ResultOptions.md
Normal file
27
docs/framework/lit/reference/interfaces/ResultOptions.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
id: ResultOptions
|
||||
title: ResultOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:694](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L694)
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`RefetchOptions`](RefetchOptions.md)
|
||||
- [`FetchNextPageOptions`](FetchNextPageOptions.md)
|
||||
- [`FetchPreviousPageOptions`](FetchPreviousPageOptions.md)
|
||||
|
||||
## Properties
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:701](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L701)
|
||||
|
||||
If set to `true`, the method throws if any of the underlying query refetch tasks fail.
|
||||
|
||||
Defaults to `false`, in which case failed refetches are swallowed and not surfaced to the
|
||||
caller.
|
||||
16
docs/framework/lit/reference/interfaces/SetDataOptions.md
Normal file
16
docs/framework/lit/reference/interfaces/SetDataOptions.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
id: SetDataOptions
|
||||
title: SetDataOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1526](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1526)
|
||||
|
||||
## Properties
|
||||
|
||||
### updatedAt?
|
||||
|
||||
```ts
|
||||
optional updatedAt: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/types.ts:1527](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1527)
|
||||
246
docs/framework/lit/reference/interfaces/TimeoutManager.md
Normal file
246
docs/framework/lit/reference/interfaces/TimeoutManager.md
Normal file
@@ -0,0 +1,246 @@
|
||||
---
|
||||
id: TimeoutManager
|
||||
title: TimeoutManager
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/timeoutManager.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L70)
|
||||
|
||||
Allows customization of how timeouts are created.
|
||||
|
||||
@tanstack/query-core makes liberal use of timeouts to implement `staleTime`
|
||||
and `gcTime`. The default TimeoutManager provider uses the platform's global
|
||||
`setTimeout` implementation, which is known to have scalability issues with
|
||||
thousands of timeouts on the event loop.
|
||||
|
||||
If you hit this limitation, consider providing a custom TimeoutProvider that
|
||||
coalesces timeouts.
|
||||
|
||||
## Implements
|
||||
|
||||
- `Omit`\<[`TimeoutProvider`](../type-aliases/TimeoutProvider.md), `"name"`\>
|
||||
|
||||
## Methods
|
||||
|
||||
### clearInterval()
|
||||
|
||||
```ts
|
||||
clearInterval(intervalId): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/timeoutManager.ts:224](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L224)
|
||||
|
||||
`clearInterval` can be used to cancel an interval, like the global
|
||||
`clearInterval` function. It should be called with an interval ID
|
||||
returned by `setInterval`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### intervalId
|
||||
|
||||
[`ManagedTimerId`](../type-aliases/ManagedTimerId.md) | `undefined`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { timeoutManager } from '@tanstack/query-core'
|
||||
|
||||
const intervalId = timeoutManager.setInterval(
|
||||
() => console.log('ran at:', new Date()),
|
||||
1000,
|
||||
)
|
||||
|
||||
timeoutManager.clearInterval(intervalId)
|
||||
```
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[`TimeoutProvider`](../type-aliases/TimeoutProvider.md).[`clearInterval`](../type-aliases/TimeoutProvider.md#clearinterval)
|
||||
|
||||
***
|
||||
|
||||
### clearTimeout()
|
||||
|
||||
```ts
|
||||
clearTimeout(timeoutId): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/timeoutManager.ts:179](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L179)
|
||||
|
||||
`clearTimeout` cancels a timeout callback scheduled with `setTimeout`,
|
||||
like the global `clearTimeout` function. It should be called with a
|
||||
timer ID returned by `setTimeout`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### timeoutId
|
||||
|
||||
[`ManagedTimerId`](../type-aliases/ManagedTimerId.md) | `undefined`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { timeoutManager } from '@tanstack/query-core'
|
||||
|
||||
const timeoutId = timeoutManager.setTimeout(
|
||||
() => console.log('ran at:', new Date()),
|
||||
1000,
|
||||
)
|
||||
|
||||
timeoutManager.clearTimeout(timeoutId)
|
||||
```
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[`TimeoutProvider`](../type-aliases/TimeoutProvider.md).[`clearTimeout`](../type-aliases/TimeoutProvider.md#cleartimeout)
|
||||
|
||||
***
|
||||
|
||||
### setInterval()
|
||||
|
||||
```ts
|
||||
setInterval(callback, delay): ManagedTimerId;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/timeoutManager.ts:200](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L200)
|
||||
|
||||
`setInterval` schedules a callback to be called approximately every
|
||||
`delay` milliseconds, like the global `setInterval` function.
|
||||
|
||||
Like `setTimeout`, it returns a timer ID, which may be a number or an
|
||||
object that can be coerced to a number via `Symbol.toPrimitive`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### callback
|
||||
|
||||
[`TimeoutCallback`](../type-aliases/TimeoutCallback.md)
|
||||
|
||||
##### delay
|
||||
|
||||
`number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ManagedTimerId`](../type-aliases/ManagedTimerId.md)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { timeoutManager } from '@tanstack/query-core'
|
||||
|
||||
const intervalId = timeoutManager.setInterval(
|
||||
() => console.log('ran at:', new Date()),
|
||||
1000,
|
||||
)
|
||||
```
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[`TimeoutProvider`](../type-aliases/TimeoutProvider.md).[`setInterval`](../type-aliases/TimeoutProvider.md#setinterval)
|
||||
|
||||
***
|
||||
|
||||
### setTimeout()
|
||||
|
||||
```ts
|
||||
setTimeout(callback, delay): ManagedTimerId;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/timeoutManager.ts:155](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L155)
|
||||
|
||||
`setTimeout` schedules a callback to run after approximately `delay`
|
||||
milliseconds, like the global `setTimeout` function. The callback can be
|
||||
canceled with `clearTimeout`.
|
||||
|
||||
It returns a timer ID, which may be a number or an object that can be
|
||||
coerced to a number via `Symbol.toPrimitive`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### callback
|
||||
|
||||
[`TimeoutCallback`](../type-aliases/TimeoutCallback.md)
|
||||
|
||||
##### delay
|
||||
|
||||
`number`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ManagedTimerId`](../type-aliases/ManagedTimerId.md)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { timeoutManager } from '@tanstack/query-core'
|
||||
|
||||
const timeoutId = timeoutManager.setTimeout(
|
||||
() => console.log('ran at:', new Date()),
|
||||
1000,
|
||||
)
|
||||
|
||||
const timeoutIdNumber: number = Number(timeoutId)
|
||||
```
|
||||
|
||||
#### Implementation of
|
||||
|
||||
[`TimeoutProvider`](../type-aliases/TimeoutProvider.md).[`setTimeout`](../type-aliases/TimeoutProvider.md#settimeout)
|
||||
|
||||
***
|
||||
|
||||
### setTimeoutProvider()
|
||||
|
||||
```ts
|
||||
setTimeoutProvider<TTimerId>(provider): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/timeoutManager.ts:106](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L106)
|
||||
|
||||
`setTimeoutProvider` can be used to set a custom implementation of the
|
||||
`setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` functions,
|
||||
called a `TimeoutProvider`.
|
||||
|
||||
This may be useful if you notice event loop performance issues with
|
||||
thousands of queries. A custom TimeoutProvider could also support timer
|
||||
delays longer than the global `setTimeout` maximum delay value of about
|
||||
24 days.
|
||||
|
||||
It is important to call `setTimeoutProvider` before creating a
|
||||
QueryClient or queries, so that the same provider is used consistently
|
||||
for all timers in the application, since different TimeoutProviders
|
||||
cannot cancel each others' timers.
|
||||
|
||||
#### Type Parameters
|
||||
|
||||
##### TTimerId
|
||||
|
||||
`TTimerId` *extends* [`ManagedTimerId`](../type-aliases/ManagedTimerId.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### provider
|
||||
|
||||
[`TimeoutProvider`](../type-aliases/TimeoutProvider.md)\<`TTimerId`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { timeoutManager, QueryClient } from '@tanstack/query-core'
|
||||
import { CustomTimeoutProvider } from './CustomTimeoutProvider'
|
||||
|
||||
timeoutManager.setTimeoutProvider(new CustomTimeoutProvider())
|
||||
|
||||
export const queryClient = new QueryClient()
|
||||
```
|
||||
Reference in New Issue
Block a user