snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
273
docs/framework/angular/reference/classes/CancelledError.md
Normal file
273
docs/framework/angular/reference/classes/CancelledError.md
Normal file
@@ -0,0 +1,273 @@
|
||||
---
|
||||
id: CancelledError
|
||||
title: CancelledError
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/retryer.ts:77](https://github.com/TanStack/query/blob/main/packages/query-core/src/retryer.ts#L77)
|
||||
|
||||
The error thrown by a `Retryer` (and surfaced to `query.promise`/`mutation`) when a fetch is cancelled, e.g. via
|
||||
`query.cancel()`. `revert`, if `true`, tells the caller to restore the state the query was in before the fetch
|
||||
started instead of surfacing the error. `silent`, if `true`, tells the caller to suppress this error and instead
|
||||
resolve with the promise of the fetch that triggered the cancellation.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
query.cancel()
|
||||
|
||||
try {
|
||||
await query.promise
|
||||
} catch (error) {
|
||||
if (error instanceof CancelledError) {
|
||||
// the fetch was cancelled, e.g. via `query.cancel()`
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Error`
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new CancelledError(options?): CancelledError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/retryer.ts:80](https://github.com/TanStack/query/blob/main/packages/query-core/src/retryer.ts#L80)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`CancelOptions`](../interfaces/CancelOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`CancelledError`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Error.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### cause?
|
||||
|
||||
```ts
|
||||
optional cause: unknown;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.cause
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### message
|
||||
|
||||
```ts
|
||||
message: string;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.message
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### name
|
||||
|
||||
```ts
|
||||
name: string;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.name
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### revert?
|
||||
|
||||
```ts
|
||||
optional revert: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/retryer.ts:78](https://github.com/TanStack/query/blob/main/packages/query-core/src/retryer.ts#L78)
|
||||
|
||||
***
|
||||
|
||||
### silent?
|
||||
|
||||
```ts
|
||||
optional silent: boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/retryer.ts:79](https://github.com/TanStack/query/blob/main/packages/query-core/src/retryer.ts#L79)
|
||||
|
||||
***
|
||||
|
||||
### stack?
|
||||
|
||||
```ts
|
||||
optional stack: string;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.stack
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### stackTraceLimit
|
||||
|
||||
```ts
|
||||
static stackTraceLimit: number;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/@types+node@22.19.15/node\_modules/@types/node/globals.d.ts:68
|
||||
|
||||
The `Error.stackTraceLimit` property specifies the number of stack frames
|
||||
collected by a stack trace (whether generated by `new Error().stack` or
|
||||
`Error.captureStackTrace(obj)`).
|
||||
|
||||
The default value is `10` but may be set to any valid JavaScript number. Changes
|
||||
will affect any stack trace captured _after_ the value has been changed.
|
||||
|
||||
If set to a non-number value, or set to a negative number, stack traces will
|
||||
not capture any frames.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.stackTraceLimit
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### captureStackTrace()
|
||||
|
||||
```ts
|
||||
static captureStackTrace(targetObject, constructorOpt?): void;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/@types+node@22.19.15/node\_modules/@types/node/globals.d.ts:52
|
||||
|
||||
Creates a `.stack` property on `targetObject`, which when accessed returns
|
||||
a string representing the location in the code at which
|
||||
`Error.captureStackTrace()` was called.
|
||||
|
||||
```js
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
myObject.stack; // Similar to `new Error().stack`
|
||||
```
|
||||
|
||||
The first line of the trace will be prefixed with
|
||||
`${myObject.name}: ${myObject.message}`.
|
||||
|
||||
The optional `constructorOpt` argument accepts a function. If given, all frames
|
||||
above `constructorOpt`, including `constructorOpt`, will be omitted from the
|
||||
generated stack trace.
|
||||
|
||||
The `constructorOpt` argument is useful for hiding implementation
|
||||
details of error generation from the user. For instance:
|
||||
|
||||
```js
|
||||
function a() {
|
||||
b();
|
||||
}
|
||||
|
||||
function b() {
|
||||
c();
|
||||
}
|
||||
|
||||
function c() {
|
||||
// Create an error without stack trace to avoid calculating the stack trace twice.
|
||||
const { stackTraceLimit } = Error;
|
||||
Error.stackTraceLimit = 0;
|
||||
const error = new Error();
|
||||
Error.stackTraceLimit = stackTraceLimit;
|
||||
|
||||
// Capture the stack trace above function b
|
||||
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
|
||||
throw error;
|
||||
}
|
||||
|
||||
a();
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### targetObject
|
||||
|
||||
`object`
|
||||
|
||||
##### constructorOpt?
|
||||
|
||||
`Function`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.captureStackTrace
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### prepareStackTrace()
|
||||
|
||||
```ts
|
||||
static prepareStackTrace(err, stackTraces): any;
|
||||
```
|
||||
|
||||
Defined in: node\_modules/.pnpm/@types+node@22.19.15/node\_modules/@types/node/globals.d.ts:56
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### err
|
||||
|
||||
`Error`
|
||||
|
||||
##### stackTraces
|
||||
|
||||
`CallSite`[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
#### See
|
||||
|
||||
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Error.prepareStackTrace
|
||||
```
|
||||
@@ -0,0 +1,665 @@
|
||||
---
|
||||
id: InfiniteQueryObserver
|
||||
title: InfiniteQueryObserver
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:41](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L41)
|
||||
|
||||
An `InfiniteQueryObserver` extends `QueryObserver` to observe and switch
|
||||
between infinite queries. It augments the base `QueryObserverResult` with
|
||||
infinite-query-specific fields and methods, such as `hasNextPage` and
|
||||
`fetchNextPage`, and is the primitive that framework adapters (e.g.
|
||||
`useInfiniteQuery`) build their hooks on top of.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const observer = new InfiniteQueryObserver(queryClient, {
|
||||
queryKey: ['projects'],
|
||||
queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||
})
|
||||
|
||||
const unsubscribe = observer.subscribe((result) => console.log(result))
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserver`](QueryObserver.md)\<`TQueryFnData`, `TError`, `TData`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`\>
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new InfiniteQueryObserver<TQueryFnData, TError, TData, TQueryKey, TPageParam>(client, options): InfiniteQueryObserver<TQueryFnData, TError, TData, TQueryKey, TPageParam>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L83)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### client
|
||||
|
||||
[`QueryClient`](QueryClient.md)
|
||||
|
||||
##### options
|
||||
|
||||
[`InfiniteQueryObserverOptions`](../interfaces/InfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`InfiniteQueryObserver`\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`constructor`](QueryObserver.md#constructor)
|
||||
|
||||
## Properties
|
||||
|
||||
### fetch
|
||||
|
||||
```ts
|
||||
protected fetch: ReplaceReturnType<(fetchOptions) => Promise<QueryObserverResult<TData, TError>>, Promise<InfiniteQueryObserverResult<TData, TError>>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:72](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L72)
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
QueryObserver.fetch
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getCurrentResult
|
||||
|
||||
```ts
|
||||
getCurrentResult: ReplaceReturnType<() => QueryObserverResult<TData, TError>, InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:60](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L60)
|
||||
|
||||
Returns the most recently computed `QueryObserverResult` for the
|
||||
observed query. This is a point-in-time read; to be notified of updates
|
||||
as they happen, subscribe to the observer instead (its inherited
|
||||
`subscribe` method).
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const result = observer.getCurrentResult()
|
||||
console.log(result.status, result.data)
|
||||
```
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
QueryObserver.getCurrentResult
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<QueryObserverListener<TData, TError>>;
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`listeners`](QueryObserver.md#listeners)
|
||||
|
||||
***
|
||||
|
||||
### options
|
||||
|
||||
```ts
|
||||
options: QueryObserverOptions<TQueryFnData, TError, TData, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:89](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L89)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`options`](QueryObserver.md#options)
|
||||
|
||||
***
|
||||
|
||||
### subscribe()
|
||||
|
||||
```ts
|
||||
subscribe: (listener) => () => void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:55](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L55)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### listener
|
||||
|
||||
`InfiniteQueryObserverListener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
QueryObserver.subscribe
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
### bindMethods()
|
||||
|
||||
```ts
|
||||
protected bindMethods(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:96](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L96)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`bindMethods`](QueryObserver.md#bindmethods)
|
||||
|
||||
***
|
||||
|
||||
### createResult()
|
||||
|
||||
```ts
|
||||
protected createResult(query, options): InfiniteQueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:201](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L201)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>
|
||||
|
||||
##### options
|
||||
|
||||
[`InfiniteQueryObserverOptions`](../interfaces/InfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`createResult`](QueryObserver.md#createresult)
|
||||
|
||||
***
|
||||
|
||||
### destroy()
|
||||
|
||||
```ts
|
||||
destroy(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:161](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L161)
|
||||
|
||||
Stops observing the current query: clears all listeners, cancels the
|
||||
stale and refetch-interval timers, and removes this observer from the
|
||||
query it was observing.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`destroy`](QueryObserver.md#destroy)
|
||||
|
||||
***
|
||||
|
||||
### fetchNextPage()
|
||||
|
||||
```ts
|
||||
fetchNextPage(options?): Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:161](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L161)
|
||||
|
||||
Fetches the next page of the infinite query and returns a promise that
|
||||
resolves with the resulting `InfiniteQueryObserverResult`. The page
|
||||
param used for the fetch is determined by `getNextPageParam`, which
|
||||
receives the current pages/page params and whose result also determines
|
||||
`hasNextPage`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchNextPageOptions`](../interfaces/FetchNextPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const { hasNextPage } = observer.getCurrentResult()
|
||||
|
||||
if (hasNextPage) {
|
||||
await observer.fetchNextPage()
|
||||
}
|
||||
```
|
||||
|
||||
#### See
|
||||
|
||||
[InfiniteQueryObserver#fetchPreviousPage](#fetchpreviouspage)
|
||||
|
||||
***
|
||||
|
||||
### fetchOptimistic()
|
||||
|
||||
```ts
|
||||
fetchOptimistic(options): Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:395](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L395)
|
||||
|
||||
Fetches a query defined by the given options without affecting this
|
||||
observer's own tracked query or result, and returns a promise that
|
||||
resolves with the `QueryObserverResult` for that fetch. This is useful
|
||||
for prefetching data that another observer (e.g. a query about to be
|
||||
navigated to) will need, ahead of time.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const result = await observer.fetchOptimistic({
|
||||
queryKey: ['posts', 2],
|
||||
queryFn: () => fetchPost(2),
|
||||
})
|
||||
console.log(result.data)
|
||||
```
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`fetchOptimistic`](QueryObserver.md#fetchoptimistic)
|
||||
|
||||
***
|
||||
|
||||
### fetchPreviousPage()
|
||||
|
||||
```ts
|
||||
fetchPreviousPage(options?): Promise<InfiniteQueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:190](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L190)
|
||||
|
||||
Fetches the previous page of the infinite query and returns a promise
|
||||
that resolves with the resulting `InfiniteQueryObserverResult`. The page
|
||||
param used for the fetch is determined by `getPreviousPageParam`, which
|
||||
receives the current pages/page params and whose result also determines
|
||||
`hasPreviousPage`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`FetchPreviousPageOptions`](../interfaces/FetchPreviousPageOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const { hasPreviousPage } = observer.getCurrentResult()
|
||||
|
||||
if (hasPreviousPage) {
|
||||
await observer.fetchPreviousPage()
|
||||
}
|
||||
```
|
||||
|
||||
#### See
|
||||
|
||||
[InfiniteQueryObserver#fetchNextPage](#fetchnextpage)
|
||||
|
||||
***
|
||||
|
||||
### getCurrentQuery()
|
||||
|
||||
```ts
|
||||
getCurrentQuery(): Query<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:357](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L357)
|
||||
|
||||
Returns the `Query` instance this observer is currently observing.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Query`](Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`getCurrentQuery`](QueryObserver.md#getcurrentquery)
|
||||
|
||||
***
|
||||
|
||||
### getOptimisticResult()
|
||||
|
||||
```ts
|
||||
getOptimisticResult(options): InfiniteQueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:127](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L127)
|
||||
|
||||
The infinite-query counterpart of [QueryObserver#getOptimisticResult](QueryObserver.md#getoptimisticresult), marking the
|
||||
options as an infinite query before delegating to it. Called by framework adapters (e.g.
|
||||
`useInfiniteQuery`) ahead of subscribing, to compute the current `InfiniteQueryObserverResult`
|
||||
synchronously.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`DefaultedInfiniteQueryObserverOptions`](../type-aliases/DefaultedInfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`InfiniteQueryObserverResult`](../type-aliases/InfiniteQueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`getOptimisticResult`](QueryObserver.md#getoptimisticresult)
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`hasListeners`](QueryObserver.md#haslisteners)
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:110](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L110)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`onSubscribe`](QueryObserver.md#onsubscribe)
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:124](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L124)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`onUnsubscribe`](QueryObserver.md#onunsubscribe)
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch(__namedParameters): Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:371](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L371)
|
||||
|
||||
Refetches the observed query and returns a promise that resolves with
|
||||
the resulting `QueryObserverResult`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### \_\_namedParameters
|
||||
|
||||
[`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const result = await observer.refetch({ cancelRefetch: false })
|
||||
console.log(result.data)
|
||||
```
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`refetch`](QueryObserver.md#refetch)
|
||||
|
||||
***
|
||||
|
||||
### setOptions()
|
||||
|
||||
```ts
|
||||
setOptions(options): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/infiniteQueryObserver.ts:108](https://github.com/TanStack/query/blob/main/packages/query-core/src/infiniteQueryObserver.ts#L108)
|
||||
|
||||
Updates the observer's options. Behaves the same as
|
||||
`QueryObserver.setOptions`, additionally marking the options as
|
||||
belonging to an infinite query before delegating to the base
|
||||
implementation.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`InfiniteQueryObserverOptions`](../interfaces/InfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`setOptions`](QueryObserver.md#setoptions)
|
||||
|
||||
***
|
||||
|
||||
### shouldFetchOnReconnect()
|
||||
|
||||
```ts
|
||||
shouldFetchOnReconnect(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:135](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L135)
|
||||
|
||||
Returns whether the observed query is currently stale and configured
|
||||
(via the `refetchOnReconnect` option) to refetch when the network
|
||||
reconnects.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`shouldFetchOnReconnect`](QueryObserver.md#shouldfetchonreconnect)
|
||||
|
||||
***
|
||||
|
||||
### shouldFetchOnWindowFocus()
|
||||
|
||||
```ts
|
||||
shouldFetchOnWindowFocus(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:148](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L148)
|
||||
|
||||
Returns whether the observed query is currently stale and configured
|
||||
(via the `refetchOnWindowFocus` option) to refetch when the window
|
||||
regains focus.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`shouldFetchOnWindowFocus`](QueryObserver.md#shouldfetchonwindowfocus)
|
||||
|
||||
***
|
||||
|
||||
### trackProp()
|
||||
|
||||
```ts
|
||||
trackProp(key): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:350](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L350)
|
||||
|
||||
Records that the given `QueryObserverResult` property was read, so a subsequent update only
|
||||
notifies this observer if a tracked property actually changed. Normally called indirectly via
|
||||
[QueryObserver#trackResult](QueryObserver.md#trackresult)'s proxy; exposed directly for adapters that track property
|
||||
access themselves (e.g. through their own reactivity system) instead of via the proxy.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### key
|
||||
|
||||
`"error"` | `"data"` | `"isError"` | `"isPending"` | `"isLoading"` | `"isLoadingError"` | `"isRefetchError"` | `"isSuccess"` | `"isPlaceholderData"` | `"status"` | `"dataUpdatedAt"` | `"errorUpdatedAt"` | `"failureCount"` | `"failureReason"` | `"errorUpdateCount"` | `"isFetched"` | `"isFetchedAfterMount"` | `"isFetching"` | `"isInitialLoading"` | `"isPaused"` | `"isRefetching"` | `"isStale"` | `"isEnabled"` | `"refetch"` | `"fetchStatus"`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`trackProp`](QueryObserver.md#trackprop)
|
||||
|
||||
***
|
||||
|
||||
### trackResult()
|
||||
|
||||
```ts
|
||||
trackResult(result, onPropTracked?): QueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:331](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L331)
|
||||
|
||||
Wraps a `QueryObserverResult` in a `Proxy` that records which properties are read, via
|
||||
[QueryObserver#trackProp](QueryObserver.md#trackprop) (and an optional `onPropTracked` callback). Used by framework
|
||||
adapters when `notifyOnChangeProps` is not set, to implement its default "only re-render on
|
||||
properties you actually read" behavior.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### result
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
##### onPropTracked?
|
||||
|
||||
(`key`) => `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`trackResult`](QueryObserver.md#trackresult)
|
||||
|
||||
***
|
||||
|
||||
### updateResult()
|
||||
|
||||
```ts
|
||||
updateResult(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:735](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L735)
|
||||
|
||||
Recomputes and stores the current result from the current query/options, notifying listeners
|
||||
if it changed. Framework adapters call this right after subscribing to make sure no query
|
||||
update was missed in the gap between creating the observer and subscribing to it.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserver`](QueryObserver.md).[`updateResult`](QueryObserver.md#updateresult)
|
||||
330
docs/framework/angular/reference/classes/Mutation.md
Normal file
330
docs/framework/angular/reference/classes/Mutation.md
Normal file
@@ -0,0 +1,330 @@
|
||||
---
|
||||
id: Mutation
|
||||
title: Mutation
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:135](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L135)
|
||||
|
||||
Represents a single mutation attempt. A `Mutation` holds the mutation's
|
||||
options, state (data/error/status), and the `MutationObserver`s currently
|
||||
subscribed to it.
|
||||
|
||||
Instances are created and managed internally by `MutationCache`; application
|
||||
code typically interacts with mutations indirectly through `QueryClient` or
|
||||
a framework hook like `useMutation`. Direct access to a `Mutation` instance
|
||||
is possible via `mutationCache.find()`/`getAll()` for inspecting cache state.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const mutationCache = queryClient.getMutationCache()
|
||||
|
||||
const mutation = mutationCache.find({ mutationKey: ['addPost'] })
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Removable`
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `unknown`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new Mutation<TData, TError, TVariables, TOnMutateResult>(config): Mutation<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L152)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### config
|
||||
|
||||
`MutationConfig`\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Mutation`\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Removable.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### gcTime
|
||||
|
||||
```ts
|
||||
gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:7](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L7)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.gcTime
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### mutationId
|
||||
|
||||
```ts
|
||||
readonly mutationId: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:143](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L143)
|
||||
|
||||
***
|
||||
|
||||
### options
|
||||
|
||||
```ts
|
||||
options: MutationOptions<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:142](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L142)
|
||||
|
||||
***
|
||||
|
||||
### state
|
||||
|
||||
```ts
|
||||
state: MutationState<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:141](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L141)
|
||||
|
||||
## Accessors
|
||||
|
||||
### meta
|
||||
|
||||
#### Get Signature
|
||||
|
||||
```ts
|
||||
get meta(): Record<string, unknown> | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:179](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L179)
|
||||
|
||||
The `meta` object passed in the mutation's options, if any.
|
||||
|
||||
##### Returns
|
||||
|
||||
`Record`\<`string`, `unknown`\> \| `undefined`
|
||||
|
||||
## Methods
|
||||
|
||||
### clearGcTimeout()
|
||||
|
||||
```ts
|
||||
protected clearGcTimeout(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L32)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.clearGcTimeout
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### continue()
|
||||
|
||||
```ts
|
||||
continue(): Promise<unknown>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:243](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L243)
|
||||
|
||||
Resumes a mutation that is currently paused or was restored from a
|
||||
dehydrated, still-`pending` state.
|
||||
|
||||
- If this mutation has an active retryer (it paused mid-attempt, e.g. due
|
||||
to the network mode or scope-based queuing), its retryer is resumed.
|
||||
- Otherwise, if the mutation's status is still `pending` (e.g. it was
|
||||
dehydrated while an attempt was in flight and never got a retryer in
|
||||
this instance), `execute` is called again with the last known variables.
|
||||
- Otherwise the mutation has already settled and this resolves immediately
|
||||
without running anything again.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<`unknown`\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
// typically driven by reconnect handling, e.g. queryClient.resumePausedMutations()
|
||||
const mutation = mutationCache.find({ mutationKey: ['addPost'] })
|
||||
await mutation?.continue()
|
||||
```
|
||||
|
||||
#### See
|
||||
|
||||
[Mutation#execute](#execute)
|
||||
|
||||
***
|
||||
|
||||
### destroy()
|
||||
|
||||
```ts
|
||||
destroy(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:10](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L10)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.destroy
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### execute()
|
||||
|
||||
```ts
|
||||
execute(variables): Promise<TData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:284](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L284)
|
||||
|
||||
Runs the mutation function for the given variables through a retryer, and
|
||||
drives the mutation's state and lifecycle callbacks through to settlement.
|
||||
|
||||
If this mutation's state is already `pending` when `execute` is called
|
||||
(i.e. it was restored, still in-flight, from a dehydrated state), the
|
||||
`onMutate` step is skipped and a `continue` action is dispatched to
|
||||
unpause it; otherwise a `pending` action is dispatched first, then the
|
||||
mutation cache's `onMutate` and the mutation's own `onMutate` option are
|
||||
awaited in that order, and the resulting context is stored.
|
||||
|
||||
The mutation function is then run (subject to `retry`/`retryDelay`/
|
||||
`networkMode`, and to the mutation cache's scope-based serialization).
|
||||
On success, the cache's `onSuccess`/`onSettled` callbacks run before the
|
||||
mutation's own `onSuccess`/`onSettled` options, a `success` action is
|
||||
dispatched, and the resolved data is returned. On failure, the same
|
||||
cache-then-option ordering is used for `onError`/`onSettled`, but each of
|
||||
those four callbacks is individually caught so that a throwing callback
|
||||
cannot mask the original error; an `error` action is then dispatched and
|
||||
the original error is re-thrown.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<`TData`\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
// Called internally by `MutationObserver.mutate` and `Mutation.continue` —
|
||||
// applications normally trigger mutations through those, not this method.
|
||||
const data = await mutation.execute(variables)
|
||||
```
|
||||
|
||||
#### See
|
||||
|
||||
[Mutation#continue](#continue)
|
||||
|
||||
***
|
||||
|
||||
### optionalRemove()
|
||||
|
||||
```ts
|
||||
protected optionalRemove(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutation.ts:212](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutation.ts#L212)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Removable.optionalRemove
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### scheduleGc()
|
||||
|
||||
```ts
|
||||
protected scheduleGc(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:14](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L14)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.scheduleGc
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### updateGcTime()
|
||||
|
||||
```ts
|
||||
protected updateGcTime(newGcTime): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:24](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L24)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### newGcTime
|
||||
|
||||
`number` | `undefined`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.updateGcTime
|
||||
```
|
||||
316
docs/framework/angular/reference/classes/MutationCache.md
Normal file
316
docs/framework/angular/reference/classes/MutationCache.md
Normal file
@@ -0,0 +1,316 @@
|
||||
---
|
||||
id: MutationCache
|
||||
title: MutationCache
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:124](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L124)
|
||||
|
||||
The `MutationCache` is the storage for mutations.
|
||||
|
||||
Normally, you will not interact with the `MutationCache` directly and instead use a
|
||||
`QueryClient`. You can subscribe to it (inherited from `Subscribable`) to be informed of
|
||||
safe/known updates to the cache, such as mutations being added, removed, or updated.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const unsubscribe = mutationCache.subscribe((event) => {
|
||||
console.log(event.type, event.mutation)
|
||||
})
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`MutationCacheListener`\>
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new MutationCache(config): MutationCache;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:129](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L129)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### config
|
||||
|
||||
[`MutationCacheConfig`](../interfaces/MutationCacheConfig.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
`MutationCache`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable<MutationCacheListener>.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### config
|
||||
|
||||
```ts
|
||||
config: MutationCacheConfig = {};
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:129](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L129)
|
||||
|
||||
***
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<MutationCacheListener>;
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
### clear()
|
||||
|
||||
```ts
|
||||
clear(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:236](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L236)
|
||||
|
||||
Removes all mutations from the cache.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const mutationCache = queryClient.getMutationCache()
|
||||
|
||||
mutationCache.clear()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### find()
|
||||
|
||||
```ts
|
||||
find<TData, TError, TVariables, TOnMutateResult>(filters):
|
||||
| Mutation<TData, TError, TVariables, TOnMutateResult>
|
||||
| undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:278](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L278)
|
||||
|
||||
A slightly more advanced method that can be used to get an existing mutation instance from
|
||||
the cache. If the mutation does not exist, `undefined` is returned.
|
||||
|
||||
This is not typically needed for most applications, but can come in handy when needing more
|
||||
information about a mutation in rare scenarios.
|
||||
|
||||
#### Type Parameters
|
||||
|
||||
##### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
##### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
##### TVariables
|
||||
|
||||
`TVariables` = `any`
|
||||
|
||||
##### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### filters
|
||||
|
||||
[`MutationFilters`](../interfaces/MutationFilters.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
\| [`Mutation`](Mutation.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
\| `undefined`
|
||||
|
||||
#### See
|
||||
|
||||
[MutationCache#findAll](#findall)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const mutationCache = queryClient.getMutationCache()
|
||||
|
||||
const mutation = mutationCache.find({ mutationKey: ['addPost'] })
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### findAll()
|
||||
|
||||
```ts
|
||||
findAll(filters): Mutation<unknown, Error, unknown, unknown>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:308](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L308)
|
||||
|
||||
An even more advanced method that can be used to get existing mutation instances from the
|
||||
cache that match the given filters. If no mutations match, an empty array is returned.
|
||||
|
||||
This is not typically needed for most applications, but can come in handy when needing more
|
||||
information about mutations in rare scenarios.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### filters
|
||||
|
||||
[`MutationFilters`](../interfaces/MutationFilters.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mutation`](Mutation.md)\<`unknown`, `Error`, `unknown`, `unknown`\>[]
|
||||
|
||||
#### See
|
||||
|
||||
[MutationCache#find](#find)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const mutationCache = queryClient.getMutationCache()
|
||||
|
||||
const mutations = mutationCache.findAll({ mutationKey: ['addPost'] })
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getAll()
|
||||
|
||||
```ts
|
||||
getAll(): Mutation<unknown, Error, unknown, unknown>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationCache.ts:259](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationCache.ts#L259)
|
||||
|
||||
Returns all mutations within the cache.
|
||||
|
||||
This is not typically needed for most applications, but can come in handy when needing more
|
||||
information about a mutation in rare scenarios.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Mutation`](Mutation.md)\<`unknown`, `Error`, `unknown`, `unknown`\>[]
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const mutationCache = queryClient.getMutationCache()
|
||||
|
||||
const mutations = mutationCache.getAll()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:23](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L23)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:27](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L27)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
`MutationCacheListener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
335
docs/framework/angular/reference/classes/MutationObserver.md
Normal file
335
docs/framework/angular/reference/classes/MutationObserver.md
Normal file
@@ -0,0 +1,335 @@
|
||||
---
|
||||
id: MutationObserver
|
||||
title: MutationObserver
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:38](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L38)
|
||||
|
||||
Observes a single mutation and derives a `MutationObserverResult` from it.
|
||||
A framework hook like `useMutation` creates one `MutationObserver` per hook
|
||||
call, keeps it stable across re-renders, calls `setOptions` when the options
|
||||
passed to the hook change, subscribes to it to re-render on updates, and
|
||||
reads `getCurrentResult()` for the value to return. Calling `mutate()`
|
||||
builds a new underlying `Mutation` in the `MutationCache` and executes it.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const observer = new MutationObserver(queryClient, {
|
||||
mutationFn: (variables: { title: string }) => addPost(variables),
|
||||
})
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`MutationObserverListener`\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new MutationObserver<TData, TError, TVariables, TOnMutateResult>(client, options): MutationObserver<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:58](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L58)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### client
|
||||
|
||||
[`QueryClient`](QueryClient.md)
|
||||
|
||||
##### options
|
||||
|
||||
[`MutationObserverOptions`](../interfaces/MutationObserverOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`MutationObserver`\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable<
|
||||
MutationObserverListener<TData, TError, TVariables, TOnMutateResult>
|
||||
>.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<MutationObserverListener<TData, TError, TVariables, TOnMutateResult>>;
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### options
|
||||
|
||||
```ts
|
||||
options: MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:46](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L46)
|
||||
|
||||
## Methods
|
||||
|
||||
### bindMethods()
|
||||
|
||||
```ts
|
||||
protected bindMethods(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:75](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L75)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getCurrentResult()
|
||||
|
||||
```ts
|
||||
getCurrentResult(): MutationObserverResult<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:155](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L155)
|
||||
|
||||
Returns the observer's current result, derived from the observed
|
||||
mutation's state (or the default, `idle` state if no mutation has been
|
||||
built yet, e.g. before the first `mutate()` call or after `reset()`).
|
||||
|
||||
#### Returns
|
||||
|
||||
[`MutationObserverResult`](../type-aliases/MutationObserverResult.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### mutate()
|
||||
|
||||
```ts
|
||||
mutate(variables, options?): Promise<TData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:207](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L207)
|
||||
|
||||
Builds a new `Mutation` in the `MutationCache` using the observer's
|
||||
current options, detaches this observer from any previously observed
|
||||
mutation, attaches it to the new one, and executes it with the given
|
||||
variables.
|
||||
|
||||
The optional per-call `options` (`onSuccess`/`onError`/`onSettled`) are
|
||||
invoked once the mutation settles, in addition to any callbacks defined
|
||||
on the observer's own options.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### variables
|
||||
|
||||
`TVariables`
|
||||
|
||||
##### options?
|
||||
|
||||
[`MutateOptions`](../interfaces/MutateOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<`TData`\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
await observer.mutate(
|
||||
{ title: 'New post' },
|
||||
{ onSuccess: (data) => console.log(data) },
|
||||
)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:127](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L127)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:135](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L135)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:180](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L180)
|
||||
|
||||
Detaches the observer from the mutation it is currently observing (if
|
||||
any) and resets the observed result back to its default, `idle` state.
|
||||
|
||||
This does not cancel an in-flight mutation; the mutation itself keeps
|
||||
running to completion and its own callbacks still fire, but this
|
||||
observer stops reflecting its state and a subsequent `mutate()` call
|
||||
will build a brand new mutation.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
observer.reset()
|
||||
```
|
||||
|
||||
#### See
|
||||
|
||||
[MutationObserver#mutate](#mutate)
|
||||
|
||||
***
|
||||
|
||||
### setOptions()
|
||||
|
||||
```ts
|
||||
setOptions(options): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/mutationObserver.ts:96](https://github.com/TanStack/query/blob/main/packages/query-core/src/mutationObserver.ts#L96)
|
||||
|
||||
Updates the observer's options.
|
||||
|
||||
If the new `mutationKey` differs from the previous one (and both were
|
||||
defined), the observer is reset, detaching it from the mutation it was
|
||||
observing. Otherwise, if the currently observed mutation is still
|
||||
`pending`, its options are updated in place as well.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`MutationObserverOptions`](../interfaces/MutationObserverOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
observer.setOptions({
|
||||
mutationFn: (variables: { title: string }) => addPost(variables),
|
||||
onSuccess: (data) => console.log(data),
|
||||
})
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
`MutationObserverListener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
325
docs/framework/angular/reference/classes/QueriesObserver.md
Normal file
325
docs/framework/angular/reference/classes/QueriesObserver.md
Normal file
@@ -0,0 +1,325 @@
|
||||
---
|
||||
id: QueriesObserver
|
||||
title: QueriesObserver
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:56](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L56)
|
||||
|
||||
A `QueriesObserver` watches an array of queries at once, exposing them as
|
||||
a single array of `QueryObserverResult`s (or, when a `combine` option is
|
||||
given, as a combined value derived from that array). It manages one
|
||||
internal `QueryObserver` per query, and is the primitive that framework
|
||||
adapters (e.g. `useQueries`) build their hooks on top of.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const observer = new QueriesObserver(queryClient, [
|
||||
{ queryKey: ['post', 1], queryFn: fetchPost },
|
||||
{ queryKey: ['post', 2], queryFn: fetchPost },
|
||||
])
|
||||
|
||||
const unsubscribe = observer.subscribe((result) => {
|
||||
console.log(result)
|
||||
})
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`QueriesObserverListener`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TCombinedResult
|
||||
|
||||
`TCombinedResult` = [`QueryObserverResult`](../type-aliases/QueryObserverResult.md)[]
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new QueriesObserver<TCombinedResult>(
|
||||
client,
|
||||
queries,
|
||||
options?): QueriesObserver<TCombinedResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L70)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### client
|
||||
|
||||
[`QueryClient`](QueryClient.md)
|
||||
|
||||
##### queries
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`any`, `any`, `any`, `any`, `any`, `never`\>[]
|
||||
|
||||
##### options?
|
||||
|
||||
[`QueriesObserverOptions`](../interfaces/QueriesObserverOptions.md)\<`TCombinedResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`QueriesObserver`\<`TCombinedResult`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable<QueriesObserverListener>.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<QueriesObserverListener>;
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
### destroy()
|
||||
|
||||
```ts
|
||||
destroy(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:106](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L106)
|
||||
|
||||
Stops observing all queries: clears all listeners and destroys every
|
||||
underlying `QueryObserver` this observer manages.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### getCurrentResult()
|
||||
|
||||
```ts
|
||||
getCurrentResult(): QueryObserverResult[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:210](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L210)
|
||||
|
||||
Returns the most recently computed array of `QueryObserverResult`s, one
|
||||
per observed query, in the same order as the queries passed to the
|
||||
constructor or `setQueries`.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)[]
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const results = observer.getCurrentResult()
|
||||
const data = results.map((result) => result.data)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getObservers()
|
||||
|
||||
```ts
|
||||
getObservers(): QueryObserver<unknown, Error, unknown, unknown, readonly unknown[]>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:227](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L227)
|
||||
|
||||
Returns the underlying `QueryObserver` instances this observer manages,
|
||||
in the same order as the queries passed to the constructor or
|
||||
`setQueries`.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserver`](QueryObserver.md)\<`unknown`, `Error`, `unknown`, `unknown`, readonly `unknown`[]\>[]
|
||||
|
||||
***
|
||||
|
||||
### getOptimisticResult()
|
||||
|
||||
```ts
|
||||
getOptimisticResult(queries, combine): [QueryObserverResult[], (r?) => TCombinedResult, () => QueryObserverResult[]];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:238](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L238)
|
||||
|
||||
The `QueriesObserver` counterpart of [QueryObserver#getOptimisticResult](QueryObserver.md#getoptimisticresult) — computes
|
||||
the result for the given (already-defaulted) queries right now, synchronously. Called by
|
||||
framework adapters (e.g. `useQueries`) ahead of subscribing, returning a tuple of the raw
|
||||
per-query results, a function to compute the combined result from them, and a function to
|
||||
wrap the results for property-access tracking.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### queries
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`, readonly `unknown`[], `never`\>[]
|
||||
|
||||
##### combine
|
||||
|
||||
`CombineFn`\<`TCombinedResult`\> | `undefined`
|
||||
|
||||
#### Returns
|
||||
|
||||
\[[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)[], (`r?`) => `TCombinedResult`, () => [`QueryObserverResult`](../type-aliases/QueryObserverResult.md)[]\]
|
||||
|
||||
***
|
||||
|
||||
### getQueries()
|
||||
|
||||
```ts
|
||||
getQueries(): Query<unknown, Error, unknown, readonly unknown[]>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:218](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L218)
|
||||
|
||||
Returns the underlying `Query` instances currently being observed, in
|
||||
the same order as the queries passed to the constructor or `setQueries`.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Query`](Query.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[]\>[]
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:86](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L86)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:96](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L96)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setQueries()
|
||||
|
||||
```ts
|
||||
setQueries(queries, options?): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queriesObserver.ts:127](https://github.com/TanStack/query/blob/main/packages/query-core/src/queriesObserver.ts#L127)
|
||||
|
||||
Replaces the set of queries being observed. Existing `QueryObserver`s
|
||||
are reused for queries that match an already-observed query hash;
|
||||
observers for queries that are no longer present are destroyed, and new
|
||||
observers are created and subscribed to for newly added queries.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### queries
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`, readonly `unknown`[], `never`\>[]
|
||||
|
||||
##### options?
|
||||
|
||||
[`QueriesObserverOptions`](../interfaces/QueriesObserverOptions.md)\<`TCombinedResult`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
observer.setQueries([
|
||||
{ queryKey: ['post', 1], queryFn: fetchPost },
|
||||
{ queryKey: ['post', 3], queryFn: fetchPost },
|
||||
])
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
`QueriesObserverListener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
585
docs/framework/angular/reference/classes/Query.md
Normal file
585
docs/framework/angular/reference/classes/Query.md
Normal file
@@ -0,0 +1,585 @@
|
||||
---
|
||||
id: Query
|
||||
title: Query
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:225](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L225)
|
||||
|
||||
Represents a single cached query. A `Query` holds the query's key, options,
|
||||
state (data/error/status), and the observers currently subscribed to it.
|
||||
|
||||
Instances are created and managed internally by `QueryCache`; application
|
||||
code typically interacts with queries indirectly through `QueryClient` or
|
||||
a framework hook like `useQuery`. Direct access to a `Query` instance is
|
||||
possible via `queryCache.find()`/`findAll()` for inspecting cache state.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
const query = queryCache.find({ queryKey: ['posts'] })
|
||||
|
||||
if (query) {
|
||||
console.log(query.state.dataUpdatedAt)
|
||||
}
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Removable`
|
||||
|
||||
## 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)
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new Query<TQueryFnData, TError, TData, TQueryKey>(config): Query<TQueryFnData, TError, TData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:246](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L246)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### config
|
||||
|
||||
`QueryConfig`\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Query`\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Removable.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### gcTime
|
||||
|
||||
```ts
|
||||
gcTime: number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:7](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L7)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.gcTime
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### observers
|
||||
|
||||
```ts
|
||||
observers: QueryObserver<any, any, any, any, any>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:242](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L242)
|
||||
|
||||
***
|
||||
|
||||
### options
|
||||
|
||||
```ts
|
||||
options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:233](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L233)
|
||||
|
||||
***
|
||||
|
||||
### queryHash
|
||||
|
||||
```ts
|
||||
queryHash: string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:232](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L232)
|
||||
|
||||
***
|
||||
|
||||
### queryKey
|
||||
|
||||
```ts
|
||||
queryKey: TQueryKey;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:231](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L231)
|
||||
|
||||
***
|
||||
|
||||
### state
|
||||
|
||||
```ts
|
||||
state: QueryState<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:234](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L234)
|
||||
|
||||
## Accessors
|
||||
|
||||
### meta
|
||||
|
||||
#### Get Signature
|
||||
|
||||
```ts
|
||||
get meta(): Record<string, unknown> | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:264](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L264)
|
||||
|
||||
The `meta` object passed in the query's options, if any.
|
||||
|
||||
##### Returns
|
||||
|
||||
`Record`\<`string`, `unknown`\> \| `undefined`
|
||||
|
||||
***
|
||||
|
||||
### promise
|
||||
|
||||
#### Get Signature
|
||||
|
||||
```ts
|
||||
get promise(): Promise<TData> | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L277)
|
||||
|
||||
The promise for the currently in-flight fetch, if the query is fetching.
|
||||
`undefined` when the query is not fetching.
|
||||
|
||||
##### Returns
|
||||
|
||||
`Promise`\<`TData`\> \| `undefined`
|
||||
|
||||
## Methods
|
||||
|
||||
### cancel()
|
||||
|
||||
```ts
|
||||
cancel(options?): Promise<void>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:348](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L348)
|
||||
|
||||
Cancels the query's currently in-flight fetch, if any.
|
||||
- Returns a promise that resolves once the cancellation has settled.
|
||||
- If no fetch is in progress, resolves immediately.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`CancelOptions`](../interfaces/CancelOptions.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<`void`\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
await query.cancel()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### clearGcTimeout()
|
||||
|
||||
```ts
|
||||
protected clearGcTimeout(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L32)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.clearGcTimeout
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### destroy()
|
||||
|
||||
```ts
|
||||
destroy(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:361](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L361)
|
||||
|
||||
Clears the query's garbage collection timeout and silently cancels any
|
||||
in-flight fetch. Called by `QueryCache` when the query is removed from
|
||||
the cache.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### See
|
||||
|
||||
[Query#cancel](#cancel)
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Removable.destroy
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### fetch()
|
||||
|
||||
```ts
|
||||
fetch(options?, fetchOptions?): Promise<TData>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:590](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L590)
|
||||
|
||||
Fetches the query, i.e. runs its `queryFn` (through any configured
|
||||
retryer/behavior) and updates the query's state with the result.
|
||||
- If a fetch is already in flight, returns its promise instead of
|
||||
starting a new one, unless `fetchOptions.cancelRefetch` is set and the
|
||||
query already has data, in which case the current fetch is silently
|
||||
cancelled first.
|
||||
- If `options` is passed, it replaces the query's current options
|
||||
before fetching.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options?
|
||||
|
||||
[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `never`\>
|
||||
|
||||
##### fetchOptions?
|
||||
|
||||
`FetchOptions`\<`TQueryFnData`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<`TData`\>
|
||||
|
||||
***
|
||||
|
||||
### getObserversCount()
|
||||
|
||||
```ts
|
||||
getObserversCount(): number;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:560](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L560)
|
||||
|
||||
Returns the number of observers currently subscribed to this query.
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
if (query.getObserversCount() === 0) {
|
||||
// no component is currently watching this query
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### invalidate()
|
||||
|
||||
```ts
|
||||
invalidate(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:574](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L574)
|
||||
|
||||
Marks the query as invalidated, unless it is already invalidated. This
|
||||
updates `state.isInvalidated` and notifies observers, but does not by
|
||||
itself trigger a refetch.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
query.invalidate()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### isActive()
|
||||
|
||||
```ts
|
||||
isActive(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:386](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L386)
|
||||
|
||||
Returns `true` if the query has at least one observer for which `enabled`
|
||||
does not resolve to `false`.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isDisabled()
|
||||
|
||||
```ts
|
||||
isDisabled(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:400](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L400)
|
||||
|
||||
Returns `true` if the query is disabled, meaning it will not fetch
|
||||
automatically.
|
||||
- If the query has observers, it is disabled when none of them are active
|
||||
(see `isActive`).
|
||||
- If the query has no observers, it is disabled when its `queryFn` is
|
||||
`skipToken` or it has never been fetched.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isFetched()
|
||||
|
||||
```ts
|
||||
isFetched(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:412](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L412)
|
||||
|
||||
Returns `true` if the query has been fetched, i.e. it has resolved with
|
||||
either data or an error at least once.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### isStale()
|
||||
|
||||
```ts
|
||||
isStale(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:447](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L447)
|
||||
|
||||
Returns `true` if the query is stale.
|
||||
- If the query has observers, defers to whether any observer's current
|
||||
result reports `isStale` (which accounts for each observer's own
|
||||
`staleTime` and `enabled` state).
|
||||
- If the query has no observers, it is considered stale when it has no
|
||||
data or has been invalidated.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### See
|
||||
|
||||
[Query#isStaleByTime](#isstalebytime)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
if (query.isStale()) {
|
||||
// refetch or otherwise treat the cached data as outdated
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### isStaleByTime()
|
||||
|
||||
```ts
|
||||
isStaleByTime(staleTime): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:473](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L473)
|
||||
|
||||
Returns `true` if the query's data is stale relative to the given
|
||||
`staleTime` (defaults to `0`).
|
||||
- A query with no data is always stale.
|
||||
- `staleTime: 'static'` is never stale.
|
||||
- An invalidated query is always stale.
|
||||
- Otherwise, staleness is based on elapsed time since `dataUpdatedAt`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### staleTime
|
||||
|
||||
[`StaleTime`](../type-aliases/StaleTime.md) = `0`
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### See
|
||||
|
||||
[Query#isStale](#isstale)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const isStale = query.isStaleByTime(1000 * 60)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### isStatic()
|
||||
|
||||
```ts
|
||||
isStatic(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:420](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L420)
|
||||
|
||||
Returns `true` if the query has at least one observer configured with
|
||||
`staleTime: 'static'`, meaning it is treated as never stale.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### optionalRemove()
|
||||
|
||||
```ts
|
||||
protected optionalRemove(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:305](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L305)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Removable.optionalRemove
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### reset()
|
||||
|
||||
```ts
|
||||
reset(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:377](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L377)
|
||||
|
||||
Resets the query back to its initial state (the state it had when it was
|
||||
first created, e.g. any `initialData`), destroying it first to cancel any
|
||||
in-flight fetch.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### scheduleGc()
|
||||
|
||||
```ts
|
||||
protected scheduleGc(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:14](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L14)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.scheduleGc
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setState()
|
||||
|
||||
```ts
|
||||
setState(state): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/query.ts:334](https://github.com/TanStack/query/blob/main/packages/query-core/src/query.ts#L334)
|
||||
|
||||
Merges the given partial state directly into this query's state, notifying observers. Used
|
||||
by persistence and broadcast plugins to restore a state snapshot, and by devtools to let a
|
||||
user manually trigger a loading/error state or edit the cached data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### state
|
||||
|
||||
`Partial`\<[`QueryState`](../interfaces/QueryState.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### updateGcTime()
|
||||
|
||||
```ts
|
||||
protected updateGcTime(newGcTime): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/removable.ts:24](https://github.com/TanStack/query/blob/main/packages/query-core/src/removable.ts#L24)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### newGcTime
|
||||
|
||||
`number` | `undefined`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Removable.updateGcTime
|
||||
```
|
||||
471
docs/framework/angular/reference/classes/QueryCache.md
Normal file
471
docs/framework/angular/reference/classes/QueryCache.md
Normal file
@@ -0,0 +1,471 @@
|
||||
---
|
||||
id: QueryCache
|
||||
title: QueryCache
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:123](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L123)
|
||||
|
||||
The `QueryCache` is the storage mechanism for TanStack Query. It stores all the data, meta
|
||||
information, and state of the queries it contains.
|
||||
|
||||
Normally, you will not interact with the `QueryCache` directly and instead use a `QueryClient`
|
||||
for a specific cache. You can subscribe to it (inherited from `Subscribable`) to be informed of
|
||||
safe/known updates to the cache, such as queries being added, removed, or updated — updates made
|
||||
outside of the cache's own tracked mechanisms (e.g. mutating a query's state object directly) do
|
||||
not notify subscribers.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const unsubscribe = queryCache.subscribe((event) => {
|
||||
console.log(event.type, event.query)
|
||||
})
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`QueryCacheListener`\>
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new QueryCache(config): QueryCache;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:126](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L126)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### config
|
||||
|
||||
[`QueryCacheConfig`](../interfaces/QueryCacheConfig.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
`QueryCache`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable<QueryCacheListener>.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### config
|
||||
|
||||
```ts
|
||||
config: QueryCacheConfig = {};
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:126](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L126)
|
||||
|
||||
***
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<QueryCacheListener>;
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
### build()
|
||||
|
||||
```ts
|
||||
build<TQueryFnData, TError, TData, TQueryKey>(
|
||||
client,
|
||||
options,
|
||||
state?): Query<TQueryFnData, TError, TData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:147](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L147)
|
||||
|
||||
Returns the existing `Query` instance for the given options' `queryKey`/`queryHash`, or
|
||||
builds and adds a new one to the cache if none exists yet. Used by framework adapters and
|
||||
plugins (e.g. broadcast/persistence) that need to get-or-create a `Query` directly, bypassing
|
||||
the reactive `QueryObserver` machinery.
|
||||
|
||||
#### Type Parameters
|
||||
|
||||
##### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
##### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
##### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
##### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### client
|
||||
|
||||
[`QueryClient`](QueryClient.md)
|
||||
|
||||
##### options
|
||||
|
||||
[`WithRequired`](../type-aliases/WithRequired.md)\<[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `never`\>, `"queryKey"`\>
|
||||
|
||||
##### state?
|
||||
|
||||
[`QueryState`](../interfaces/QueryState.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Query`](Query.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
|
||||
const query = queryCache.build(queryClient, {
|
||||
queryKey: ['posts'],
|
||||
queryFn: fetchPosts,
|
||||
})
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### clear()
|
||||
|
||||
```ts
|
||||
clear(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:232](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L232)
|
||||
|
||||
Removes all queries from the cache.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
|
||||
queryCache.clear()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### find()
|
||||
|
||||
```ts
|
||||
find<TQueryFnData, TError, TData>(filters):
|
||||
| Query<TQueryFnData, TError, TData, readonly unknown[]>
|
||||
| undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:299](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L299)
|
||||
|
||||
A slightly more advanced method that can be used to get an existing query instance from the
|
||||
cache. This instance not only contains all the state for the query, but all of the instances,
|
||||
and underlying guts of the query as well. If the query does not exist, `undefined` is
|
||||
returned.
|
||||
|
||||
This is not typically needed for most applications, but can come in handy when needing more
|
||||
information about a query in rare scenarios (e.g. looking at `query.state.dataUpdatedAt` to
|
||||
decide whether a query is fresh enough to be used as an initial value).
|
||||
|
||||
#### Type Parameters
|
||||
|
||||
##### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
##### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
##### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### filters
|
||||
|
||||
[`WithRequired`](../type-aliases/WithRequired.md)\<[`QueryFilters`](../interfaces/QueryFilters.md)\<readonly `unknown`[]\>, `"queryKey"`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
\| [`Query`](Query.md)\<`TQueryFnData`, `TError`, `TData`, readonly `unknown`[]\>
|
||||
\| `undefined`
|
||||
|
||||
#### See
|
||||
|
||||
[QueryCache#findAll](#findall)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
|
||||
const query = queryCache.find({ queryKey: ['posts'] })
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### findAll()
|
||||
|
||||
```ts
|
||||
findAll(filters): Query<unknown, Error, unknown, readonly unknown[]>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:324](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L324)
|
||||
|
||||
An even more advanced method that can be used to get existing query instances from the cache
|
||||
that partially match a query key. If no queries match, an empty array is returned.
|
||||
|
||||
This is not typically needed for most applications, but can come in handy when needing more
|
||||
information about queries in rare scenarios.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### filters
|
||||
|
||||
[`QueryFilters`](../interfaces/QueryFilters.md)\<`any`\> = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Query`](Query.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[]\>[]
|
||||
|
||||
#### See
|
||||
|
||||
[QueryCache#find](#find)
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
|
||||
const queries = queryCache.findAll({ queryKey: ['posts'] })
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### get()
|
||||
|
||||
```ts
|
||||
get<TQueryFnData, TError, TData, TQueryKey>(queryHash):
|
||||
| Query<TQueryFnData, TError, TData, TQueryKey>
|
||||
| undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:254](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L254)
|
||||
|
||||
Returns the `Query` instance stored under the given `queryHash`, or `undefined` if none
|
||||
exists. Unlike [QueryCache#find](#find), this looks up by the already-computed hash rather
|
||||
than by `QueryFilters`. Used by plugins (e.g. broadcast/hydration) that already have a hash
|
||||
to look up directly.
|
||||
|
||||
#### Type Parameters
|
||||
|
||||
##### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
##### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
##### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
##### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### queryHash
|
||||
|
||||
`string`
|
||||
|
||||
#### Returns
|
||||
|
||||
\| [`Query`](Query.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
\| `undefined`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
const queryHash = hashKey(['posts'])
|
||||
|
||||
const query = queryCache.get(queryHash)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getAll()
|
||||
|
||||
```ts
|
||||
getAll(): Query<unknown, Error, unknown, readonly unknown[]>[];
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:277](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L277)
|
||||
|
||||
Returns all queries within the cache.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Query`](Query.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[]\>[]
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
|
||||
const queries = queryCache.getAll()
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:23](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L23)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/subscribable.ts:27](https://github.com/TanStack/query/blob/main/packages/query-core/src/subscribable.ts#L27)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### remove()
|
||||
|
||||
```ts
|
||||
remove(query): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryCache.ts:208](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryCache.ts#L208)
|
||||
|
||||
Destroys the given `Query` and removes it from the cache, notifying subscribers with a
|
||||
`'removed'` event. A no-op if the query is no longer the one currently stored under its hash
|
||||
(e.g. it was already replaced). Used by plugins (e.g. the broadcast client) that mirror
|
||||
removals across `QueryCache` instances.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](Query.md)\<`any`, `any`, `any`, `any`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
const query = queryCache.find({ queryKey: ['posts'] })
|
||||
|
||||
if (query) {
|
||||
queryCache.remove(query)
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
`QueryCacheListener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
1466
docs/framework/angular/reference/classes/QueryClient.md
Normal file
1466
docs/framework/angular/reference/classes/QueryClient.md
Normal file
File diff suppressed because it is too large
Load Diff
555
docs/framework/angular/reference/classes/QueryObserver.md
Normal file
555
docs/framework/angular/reference/classes/QueryObserver.md
Normal file
@@ -0,0 +1,555 @@
|
||||
---
|
||||
id: QueryObserver
|
||||
title: QueryObserver
|
||||
---
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:57](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L57)
|
||||
|
||||
A `QueryObserver` watches a single query in the `QueryCache` and computes a
|
||||
`QueryObserverResult` from its state, recomputing and notifying subscribers
|
||||
whenever the underlying query (or the observer's options) changes. It is
|
||||
the primitive that framework adapters (e.g. `useQuery`) build their hooks
|
||||
on top of, but it can also be used directly to observe and switch between
|
||||
queries outside of any framework.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const observer = new QueryObserver(queryClient, {
|
||||
queryKey: ['posts'],
|
||||
queryFn: fetchPosts,
|
||||
})
|
||||
|
||||
const unsubscribe = observer.subscribe((result) => {
|
||||
console.log(result.data)
|
||||
})
|
||||
```
|
||||
|
||||
## Extends
|
||||
|
||||
- `Subscribable`\<`QueryObserverListener`\<`TData`, `TError`\>\>
|
||||
|
||||
## Extended by
|
||||
|
||||
- [`InfiniteQueryObserver`](InfiniteQueryObserver.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)
|
||||
|
||||
## Constructors
|
||||
|
||||
### Constructor
|
||||
|
||||
```ts
|
||||
new QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>(client, options): QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:87](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L87)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### client
|
||||
|
||||
[`QueryClient`](QueryClient.md)
|
||||
|
||||
##### options
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`QueryObserver`\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable<QueryObserverListener<TData, TError>>.constructor
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
### listeners
|
||||
|
||||
```ts
|
||||
protected listeners: Set<QueryObserverListener<TData, TError>>;
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### options
|
||||
|
||||
```ts
|
||||
options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:89](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L89)
|
||||
|
||||
## Methods
|
||||
|
||||
### bindMethods()
|
||||
|
||||
```ts
|
||||
protected bindMethods(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:106](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L106)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### createResult()
|
||||
|
||||
```ts
|
||||
protected createResult(query, options): QueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:559](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L559)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
##### options
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
***
|
||||
|
||||
### destroy()
|
||||
|
||||
```ts
|
||||
destroy(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:161](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L161)
|
||||
|
||||
Stops observing the current query: clears all listeners, cancels the
|
||||
stale and refetch-interval timers, and removes this observer from the
|
||||
query it was observing.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### fetch()
|
||||
|
||||
```ts
|
||||
protected fetch(fetchOptions): Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:448](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L448)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### fetchOptions
|
||||
|
||||
`ObserverFetchOptions`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
***
|
||||
|
||||
### fetchOptimistic()
|
||||
|
||||
```ts
|
||||
fetchOptimistic(options): Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:395](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L395)
|
||||
|
||||
Fetches a query defined by the given options without affecting this
|
||||
observer's own tracked query or result, and returns a promise that
|
||||
resolves with the `QueryObserverResult` for that fetch. This is useful
|
||||
for prefetching data that another observer (e.g. a query about to be
|
||||
navigated to) will need, ahead of time.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const result = await observer.fetchOptimistic({
|
||||
queryKey: ['posts', 2],
|
||||
queryFn: () => fetchPost(2),
|
||||
})
|
||||
console.log(result.data)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getCurrentQuery()
|
||||
|
||||
```ts
|
||||
getCurrentQuery(): Query<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:357](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L357)
|
||||
|
||||
Returns the `Query` instance this observer is currently observing.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`Query`](Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
***
|
||||
|
||||
### getCurrentResult()
|
||||
|
||||
```ts
|
||||
getCurrentResult(): QueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:321](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L321)
|
||||
|
||||
Returns the most recently computed `QueryObserverResult` for the
|
||||
observed query. This is a point-in-time read; to be notified of updates
|
||||
as they happen, subscribe to the observer instead (its inherited
|
||||
`subscribe` method).
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const result = observer.getCurrentResult()
|
||||
console.log(result.status, result.data)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### getOptimisticResult()
|
||||
|
||||
```ts
|
||||
getOptimisticResult(options): QueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:272](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L272)
|
||||
|
||||
Computes the result the observer would produce for the given (already-defaulted) options
|
||||
right now, building the underlying `Query` if it doesn't exist yet, without waiting for a
|
||||
subscription callback. Called by framework adapters on every render (e.g. `useQuery`) so the
|
||||
returned value is available synchronously, ahead of `setOptions` triggering an actual fetch.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`DefaultedQueryObserverOptions`](../type-aliases/DefaultedQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onSubscribe()
|
||||
|
||||
```ts
|
||||
protected onSubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:110](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L110)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onSubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### onUnsubscribe()
|
||||
|
||||
```ts
|
||||
protected onUnsubscribe(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:124](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L124)
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Overrides
|
||||
|
||||
```ts
|
||||
Subscribable.onUnsubscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### refetch()
|
||||
|
||||
```ts
|
||||
refetch(__namedParameters): Promise<QueryObserverResult<TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:371](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L371)
|
||||
|
||||
Refetches the observed query and returns a promise that resolves with
|
||||
the resulting `QueryObserverResult`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### \_\_namedParameters
|
||||
|
||||
[`RefetchOptions`](../interfaces/RefetchOptions.md) = `{}`
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\>
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
const result = await observer.refetch({ cancelRefetch: false })
|
||||
console.log(result.data)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### setOptions()
|
||||
|
||||
```ts
|
||||
setOptions(options): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:182](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L182)
|
||||
|
||||
Updates the observer's options. This will re-resolve the query being
|
||||
observed (switching to a different query if the `queryKey` changed),
|
||||
trigger a fetch if the new options require one and the observer has
|
||||
subscribers, recompute the current result, and reschedule the stale and
|
||||
refetch-interval timers as needed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### options
|
||||
|
||||
[`QueryObserverOptions`](../interfaces/QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
observer.setOptions({ queryKey: ['posts', 1], queryFn: () => fetchPost(1) })
|
||||
// later: switch to a different query, reusing the same observer
|
||||
observer.setOptions({ queryKey: ['posts', 2], queryFn: () => fetchPost(2) })
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### shouldFetchOnReconnect()
|
||||
|
||||
```ts
|
||||
shouldFetchOnReconnect(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:135](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L135)
|
||||
|
||||
Returns whether the observed query is currently stale and configured
|
||||
(via the `refetchOnReconnect` option) to refetch when the network
|
||||
reconnects.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### shouldFetchOnWindowFocus()
|
||||
|
||||
```ts
|
||||
shouldFetchOnWindowFocus(): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:148](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L148)
|
||||
|
||||
Returns whether the observed query is currently stale and configured
|
||||
(via the `refetchOnWindowFocus` option) to refetch when the window
|
||||
regains focus.
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
`QueryObserverListener`
|
||||
|
||||
#### Returns
|
||||
|
||||
```ts
|
||||
(): void;
|
||||
```
|
||||
|
||||
##### Returns
|
||||
|
||||
`void`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
Subscribable.subscribe
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### trackProp()
|
||||
|
||||
```ts
|
||||
trackProp(key): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:350](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L350)
|
||||
|
||||
Records that the given `QueryObserverResult` property was read, so a subsequent update only
|
||||
notifies this observer if a tracked property actually changed. Normally called indirectly via
|
||||
[QueryObserver#trackResult](#trackresult)'s proxy; exposed directly for adapters that track property
|
||||
access themselves (e.g. through their own reactivity system) instead of via the proxy.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### key
|
||||
|
||||
`"error"` | `"data"` | `"isError"` | `"isPending"` | `"isLoading"` | `"isLoadingError"` | `"isRefetchError"` | `"isSuccess"` | `"isPlaceholderData"` | `"status"` | `"dataUpdatedAt"` | `"errorUpdatedAt"` | `"failureCount"` | `"failureReason"` | `"errorUpdateCount"` | `"isFetched"` | `"isFetchedAfterMount"` | `"isFetching"` | `"isInitialLoading"` | `"isPaused"` | `"isRefetching"` | `"isStale"` | `"isEnabled"` | `"refetch"` | `"fetchStatus"`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
***
|
||||
|
||||
### trackResult()
|
||||
|
||||
```ts
|
||||
trackResult(result, onPropTracked?): QueryObserverResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:331](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L331)
|
||||
|
||||
Wraps a `QueryObserverResult` in a `Proxy` that records which properties are read, via
|
||||
[QueryObserver#trackProp](#trackprop) (and an optional `onPropTracked` callback). Used by framework
|
||||
adapters when `notifyOnChangeProps` is not set, to implement its default "only re-render on
|
||||
properties you actually read" behavior.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### result
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
##### onPropTracked?
|
||||
|
||||
(`key`) => `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>
|
||||
|
||||
***
|
||||
|
||||
### updateResult()
|
||||
|
||||
```ts
|
||||
updateResult(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/queryObserver.ts:735](https://github.com/TanStack/query/blob/main/packages/query-core/src/queryObserver.ts#L735)
|
||||
|
||||
Recomputes and stores the current result from the current query/options, notifying listeners
|
||||
if it changed. Framework adapters call this right after subscribing to make sure no query
|
||||
update was missed in the gap between creating the observer and subscribing to it.
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
id: defaultShouldDehydrateMutation
|
||||
title: defaultShouldDehydrateMutation
|
||||
---
|
||||
|
||||
```ts
|
||||
function defaultShouldDehydrateMutation(mutation): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:177](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L177)
|
||||
|
||||
The default `shouldDehydrateMutation` predicate used by `dehydrate`. Only dehydrates mutations that are
|
||||
currently paused (e.g. paused by `networkMode` while offline).
|
||||
|
||||
## Parameters
|
||||
|
||||
### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)
|
||||
|
||||
## Returns
|
||||
|
||||
`boolean`
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
id: defaultShouldDehydrateQuery
|
||||
title: defaultShouldDehydrateQuery
|
||||
---
|
||||
|
||||
```ts
|
||||
function defaultShouldDehydrateQuery(query): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:185](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L185)
|
||||
|
||||
The default `shouldDehydrateQuery` predicate used by `dehydrate`. Only dehydrates queries whose status is
|
||||
`'success'`.
|
||||
|
||||
## Parameters
|
||||
|
||||
### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
## Returns
|
||||
|
||||
`boolean`
|
||||
43
docs/framework/angular/reference/functions/dehydrate.md
Normal file
43
docs/framework/angular/reference/functions/dehydrate.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: dehydrate
|
||||
title: dehydrate
|
||||
---
|
||||
|
||||
```ts
|
||||
function dehydrate(client, options): DehydratedState;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:207](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L207)
|
||||
|
||||
Dehydrates a `QueryClient`'s cache (queries and mutations) into a plain, serializable `DehydratedState`,
|
||||
typically to embed in server-rendered markup and later restore into a client-side `QueryClient` via `hydrate`.
|
||||
Which queries/mutations are included, and how their data/errors are transformed, is controlled by `options`,
|
||||
falling back to the client's `dehydrate` default options, and finally to `defaultShouldDehydrateQuery` /
|
||||
`defaultShouldDehydrateMutation`.
|
||||
|
||||
## Parameters
|
||||
|
||||
### client
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md)
|
||||
|
||||
### options
|
||||
|
||||
[`DehydrateOptions`](../interfaces/DehydrateOptions.md) = `{}`
|
||||
|
||||
## Returns
|
||||
|
||||
[`DehydratedState`](../interfaces/DehydratedState.md)
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
await queryClient.prefetchQuery({
|
||||
queryKey: ['posts'],
|
||||
queryFn: getPosts,
|
||||
})
|
||||
|
||||
const dehydratedState = dehydrate(queryClient)
|
||||
```
|
||||
43
docs/framework/angular/reference/functions/dehydrateQuery.md
Normal file
43
docs/framework/angular/reference/functions/dehydrateQuery.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: dehydrateQuery
|
||||
title: dehydrateQuery
|
||||
---
|
||||
|
||||
```ts
|
||||
function dehydrateQuery(
|
||||
query,
|
||||
serializeData?,
|
||||
shouldRedactErrors?): DehydratedQuery;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:148](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L148)
|
||||
|
||||
Dehydrates a single `Query` into a serializable `DehydratedQuery` snapshot. Note that most query config (e.g.
|
||||
`queryFn`, `staleTime`) is not dehydrated but instead meant to be configured again when consuming the
|
||||
de/rehydrated data, typically with `useQuery` on the client. If the query is still `pending`, its in-flight
|
||||
promise is dehydrated too so it can be resumed on the other side instead of re-fetched.
|
||||
|
||||
## Parameters
|
||||
|
||||
### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
The query to dehydrate.
|
||||
|
||||
### serializeData?
|
||||
|
||||
`TransformerFn`
|
||||
|
||||
Optional transform applied to `query.state.data` before it is included in the snapshot.
|
||||
|
||||
### shouldRedactErrors?
|
||||
|
||||
(`error`) => `boolean`
|
||||
|
||||
Optional predicate; if it returns `false` for the promise's rejection error, that
|
||||
error is kept as-is instead of being redacted.
|
||||
|
||||
## Returns
|
||||
|
||||
`DehydratedQuery`
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
id: experimental_streamedQuery
|
||||
title: experimental_streamedQuery
|
||||
---
|
||||
|
||||
```ts
|
||||
function experimental_streamedQuery<TQueryFnData, TData, TQueryKey>(streamFn): QueryFunction<TData, TQueryKey>;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/streamedQuery.ts:75](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L75)
|
||||
|
||||
This is a helper function to create a query function that streams data from an AsyncIterable.
|
||||
Data will be an Array of all the chunks received.
|
||||
The query will be in a 'pending' state until the first chunk of data is received, but will go to 'success' after that.
|
||||
The query will stay in fetchStatus 'fetching' until the stream ends.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`[]
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
## Parameters
|
||||
|
||||
### streamFn
|
||||
|
||||
`StreamedQueryParams`\<`TQueryFnData`, `TData`, `TQueryKey`\>
|
||||
|
||||
The function that returns an AsyncIterable to stream data from.
|
||||
|
||||
## Returns
|
||||
|
||||
[`QueryFunction`](../type-aliases/QueryFunction.md)\<`TData`, `TQueryKey`\>
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
await queryClient.query({
|
||||
queryKey: ['data'],
|
||||
queryFn: streamedQuery({
|
||||
streamFn: fetchDataInChunks,
|
||||
}),
|
||||
})
|
||||
```
|
||||
30
docs/framework/angular/reference/functions/hashKey.md
Normal file
30
docs/framework/angular/reference/functions/hashKey.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
id: hashKey
|
||||
title: hashKey
|
||||
---
|
||||
|
||||
```ts
|
||||
function hashKey(queryKey): string;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:284](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L284)
|
||||
|
||||
Default query & mutation keys hash function.
|
||||
Hashes the value into a stable hash.
|
||||
|
||||
## Parameters
|
||||
|
||||
### queryKey
|
||||
|
||||
readonly `unknown`[]
|
||||
|
||||
## Returns
|
||||
|
||||
`string`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
// Object keys are sorted, so key order doesn't affect the hash:
|
||||
hashKey(['todos', { page: 1, filter: 'done' }]) // === '["todos",{"filter":"done","page":1}]'
|
||||
```
|
||||
49
docs/framework/angular/reference/functions/hydrate.md
Normal file
49
docs/framework/angular/reference/functions/hydrate.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
id: hydrate
|
||||
title: hydrate
|
||||
---
|
||||
|
||||
```ts
|
||||
function hydrate(
|
||||
client,
|
||||
dehydratedState,
|
||||
options?): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/hydration.ts:264](https://github.com/TanStack/query/blob/main/packages/query-core/src/hydration.ts#L264)
|
||||
|
||||
Restores a `DehydratedState` (as produced by `dehydrate`) into a `QueryClient`'s cache, typically to seed the
|
||||
client with data already fetched on the server. `mutations` and `queries` are each optional on `dehydratedState`.
|
||||
Queries not yet in the cache are built from the dehydrated snapshot; queries that already exist are only updated
|
||||
when the dehydrated data is newer than what's already cached. Newly built queries have their `fetchStatus` reset
|
||||
to `'idle'` so they don't hydrate stuck in a fetching state. If a dehydrated query still had an in-flight
|
||||
promise, it is resumed via `query.fetch()` (reusing that promise as `initialPromise`) rather than re-invoking
|
||||
`queryFn`.
|
||||
|
||||
## Parameters
|
||||
|
||||
### client
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md)
|
||||
|
||||
### dehydratedState
|
||||
|
||||
`Partial`\<[`DehydratedState`](../interfaces/DehydratedState.md)\>
|
||||
|
||||
### options?
|
||||
|
||||
[`HydrateOptions`](../interfaces/HydrateOptions.md)
|
||||
|
||||
## Returns
|
||||
|
||||
`void`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
// dehydratedState was produced by `dehydrate` on the server
|
||||
// and sent to the client, e.g. embedded in server-rendered markup.
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
hydrate(queryClient, dehydratedState)
|
||||
```
|
||||
@@ -0,0 +1,285 @@
|
||||
---
|
||||
id: infiniteQueryOptions
|
||||
title: infiniteQueryOptions
|
||||
---
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function infiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>(options): CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & object & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData, unknown>, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/infinite-query-options.ts:181](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/infinite-query-options.ts#L181)
|
||||
|
||||
You can generally pass everything to `infiniteQueryOptions` that you can also pass to
|
||||
`injectInfiniteQuery`. These options can be shared across functions and imperative APIs such as
|
||||
`queryClient.fetchInfiniteQuery`. `options.queryKey` is required and is the query key to generate options
|
||||
for.
|
||||
|
||||
This overload is selected when `initialData` is set.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `unknown`\>
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`DefinedInitialDataInfiniteOptions`](../type-aliases/DefinedInitialDataInfiniteOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
The [DefinedInitialDataInfiniteOptions](../type-aliases/DefinedInitialDataInfiniteOptions.md) to use — everything you can pass to
|
||||
`injectInfiniteQuery`, with `initialData` set.
|
||||
|
||||
### Returns
|
||||
|
||||
The same options object, typed so that `queryKey` carries the inferred data type.
|
||||
|
||||
### See
|
||||
|
||||
[injectInfiniteQuery](injectInfiniteQuery.md) to run an infinite query with these options.
|
||||
|
||||
### Remarks
|
||||
|
||||
See [injectInfiniteQuery](injectInfiniteQuery.md) for examples that fetch further pages, from a button click or
|
||||
automatically as the user scrolls.
|
||||
|
||||
### Example
|
||||
|
||||
```angular-ts
|
||||
import { infiniteQueryOptions, injectInfiniteQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const projectsOptions = infiniteQueryOptions({
|
||||
queryKey: ['projects'],
|
||||
queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
initialData: { pages: [], pageParams: [] },
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'projects',
|
||||
template: `
|
||||
<!-- `projectsQuery.data()` is never `undefined`, thanks to `initialData` — even if a
|
||||
refetch fails, so the list stays visible alongside the error. -->
|
||||
<ul>
|
||||
@for (page of projectsQuery.data().pages; track $index) {
|
||||
@for (project of page.projects; track project.id) {
|
||||
<li>{{ project.name }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
`,
|
||||
})
|
||||
export class Projects {
|
||||
readonly projectsQuery = injectInfiniteQuery(() => projectsOptions)
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function infiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>(options): OmitKeyof<CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, "queryFn"> & object & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData, unknown>, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/infinite-query-options.ts:255](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/infinite-query-options.ts#L255)
|
||||
|
||||
You can generally pass everything to `infiniteQueryOptions` that you can also pass to
|
||||
`injectInfiniteQuery`. These options can be shared across functions and imperative APIs such as
|
||||
`queryClient.fetchInfiniteQuery`. `options.queryKey` is required and is the query key to generate options
|
||||
for.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `unknown`\>
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`UnusedSkipTokenInfiniteOptions`](../type-aliases/UnusedSkipTokenInfiniteOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
The [UnusedSkipTokenInfiniteOptions](../type-aliases/UnusedSkipTokenInfiniteOptions.md) to use — everything you can pass to
|
||||
`injectInfiniteQuery`.
|
||||
|
||||
### Returns
|
||||
|
||||
The same options object, typed so that `queryKey` carries the inferred data type.
|
||||
|
||||
### Remarks
|
||||
|
||||
See [injectInfiniteQuery](injectInfiniteQuery.md) for examples that fetch further pages, from a button click or
|
||||
automatically as the user scrolls.
|
||||
|
||||
### Example
|
||||
|
||||
A parameterized factory, so the same options object can be reused per `postId`:
|
||||
```angular-ts
|
||||
import { infiniteQueryOptions, injectInfiniteQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const commentsOptions = (postId: string) =>
|
||||
infiniteQueryOptions({
|
||||
queryKey: ['post', postId, 'comments'],
|
||||
queryFn: ({ pageParam }) => fetchComments(postId, pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'comments',
|
||||
template: `
|
||||
@if (commentsQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (commentsQuery.isError()) {
|
||||
<span>Error: {{ commentsQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<ul>
|
||||
@for (page of commentsQuery.data().pages; track $index) {
|
||||
@for (comment of page.comments; track comment.id) {
|
||||
<li>{{ comment.text }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Comments {
|
||||
readonly postId = signal('1')
|
||||
readonly commentsQuery = injectInfiniteQuery(() => commentsOptions(this.postId()))
|
||||
}
|
||||
```
|
||||
|
||||
### See
|
||||
|
||||
[injectInfiniteQuery](injectInfiniteQuery.md) to run an infinite query with these options.
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function infiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>(options): CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & object & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData, unknown>, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/infinite-query-options.ts:329](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/infinite-query-options.ts#L329)
|
||||
|
||||
You can generally pass everything to `infiniteQueryOptions` that you can also pass to
|
||||
`injectInfiniteQuery`. These options can be shared across functions and imperative APIs such as
|
||||
`queryClient.fetchInfiniteQuery`. `options.queryKey` is required and is the query key to generate options
|
||||
for.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `unknown`\>
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`UndefinedInitialDataInfiniteOptions`](../type-aliases/UndefinedInitialDataInfiniteOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
The [UndefinedInitialDataInfiniteOptions](../type-aliases/UndefinedInitialDataInfiniteOptions.md) to use — everything you can pass to
|
||||
`injectInfiniteQuery`.
|
||||
|
||||
### Returns
|
||||
|
||||
The same options object, typed so that `queryKey` carries the inferred data type.
|
||||
|
||||
### Remarks
|
||||
|
||||
See [injectInfiniteQuery](injectInfiniteQuery.md) for examples that fetch further pages (from a button click or
|
||||
automatically as the user scrolls) and that use `skipToken` to disable the query until `postId` is set.
|
||||
|
||||
### Example
|
||||
|
||||
A parameterized factory, so the same options object can be reused per `postId`:
|
||||
```angular-ts
|
||||
import { infiniteQueryOptions, injectInfiniteQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const commentsOptions = (postId: string) =>
|
||||
infiniteQueryOptions({
|
||||
queryKey: ['post', postId, 'comments'],
|
||||
queryFn: ({ pageParam }) => fetchComments(postId, pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'comments',
|
||||
template: `
|
||||
@if (commentsQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (commentsQuery.isError()) {
|
||||
<span>Error: {{ commentsQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<ul>
|
||||
@for (page of commentsQuery.data().pages; track $index) {
|
||||
@for (comment of page.comments; track comment.id) {
|
||||
<li>{{ comment.text }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Comments {
|
||||
readonly postId = signal('1')
|
||||
readonly commentsQuery = injectInfiniteQuery(() => commentsOptions(this.postId()))
|
||||
}
|
||||
```
|
||||
|
||||
### See
|
||||
|
||||
[injectInfiniteQuery](injectInfiniteQuery.md) to run an infinite query with these options.
|
||||
@@ -0,0 +1,350 @@
|
||||
---
|
||||
id: injectInfiniteQuery
|
||||
title: injectInfiniteQuery
|
||||
---
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function injectInfiniteQuery<TQueryFnData, TError, TData, TQueryKey, TPageParam>(injectInfiniteQueryFn, options?): DefinedCreateInfiniteQueryResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-infinite-query.ts:83](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-infinite-query.ts#L83)
|
||||
|
||||
The options for `injectInfiniteQuery` are identical to `injectQuery`, with the addition of
|
||||
`initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`. Infinite queries can
|
||||
additively "load more" data onto an existing set of data, or "infinite scroll".
|
||||
|
||||
This overload is selected when `initialData` is set on the options returned by `injectInfiniteQueryFn`,
|
||||
so the resulting `data` signal is never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `unknown`\>
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### injectInfiniteQueryFn
|
||||
|
||||
() => [`DefinedInitialDataInfiniteOptions`](../type-aliases/DefinedInitialDataInfiniteOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
A function returning the [DefinedInitialDataInfiniteOptions](../type-aliases/DefinedInitialDataInfiniteOptions.md) to use —
|
||||
everything you can pass to `injectInfiniteQuery`, with `initialData` set. Similar to `computed` from
|
||||
Angular, this function runs in the reactive context, so signals read inside it drive the query.
|
||||
|
||||
#### options?
|
||||
|
||||
[`InjectInfiniteQueryOptions`](../interfaces/InjectInfiniteQueryOptions.md)
|
||||
|
||||
Additional configuration.
|
||||
|
||||
### Returns
|
||||
|
||||
[`DefinedCreateInfiniteQueryResult`](../type-aliases/DefinedCreateInfiniteQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
The same signals as `injectQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
|
||||
`hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data().pages` and
|
||||
`data().pageParams` are also added, as long as a `select` doesn't change `TData` away from its default
|
||||
`InfiniteData<TQueryFnData>` shape.
|
||||
|
||||
### Remarks
|
||||
|
||||
Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default
|
||||
refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user
|
||||
actions, or add conditions like `hasNextPage() && !isFetching()`.
|
||||
|
||||
### See
|
||||
|
||||
[infiniteQueryOptions](infiniteQueryOptions.md) to share these options between `injectInfiniteQuery` and imperative APIs
|
||||
like `queryClient.fetchInfiniteQuery`.
|
||||
|
||||
### Example
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'projects',
|
||||
template: `
|
||||
<!-- `projectsQuery.data()` is never `undefined`, thanks to `initialData` — even if a
|
||||
refetch fails, so the list stays visible alongside the error. -->
|
||||
<ul>
|
||||
@for (page of projectsQuery.data().pages; track $index) {
|
||||
@for (project of page.projects; track project.id) {
|
||||
<li>{{ project.name }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
`,
|
||||
})
|
||||
export class Projects {
|
||||
readonly projectsQuery = injectInfiniteQuery(() => ({
|
||||
queryKey: ['projects'],
|
||||
queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
initialData: { pages: [], pageParams: [] },
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function injectInfiniteQuery<TQueryFnData, TError, TData, TQueryKey, TPageParam>(injectInfiniteQueryFn, options?): CreateInfiniteQueryResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-infinite-query.ts:239](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-infinite-query.ts#L239)
|
||||
|
||||
Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a
|
||||
unique key. Infinite queries can additively "load more" data onto an existing set of data, or
|
||||
"infinite scroll".
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `unknown`\>
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### injectInfiniteQueryFn
|
||||
|
||||
() => [`UndefinedInitialDataInfiniteOptions`](../type-aliases/UndefinedInitialDataInfiniteOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
A function returning the [UndefinedInitialDataInfiniteOptions](../type-aliases/UndefinedInitialDataInfiniteOptions.md) to use
|
||||
— everything you can pass to `injectInfiniteQuery`. Similar to `computed` from Angular, this function runs
|
||||
in the reactive context, so signals read inside it drive the query.
|
||||
|
||||
#### options?
|
||||
|
||||
[`InjectInfiniteQueryOptions`](../interfaces/InjectInfiniteQueryOptions.md)
|
||||
|
||||
Additional configuration.
|
||||
|
||||
### Returns
|
||||
|
||||
[`CreateInfiniteQueryResult`](../type-aliases/CreateInfiniteQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
The same signals as `injectQuery`, with the addition of `fetchNextPage`, `fetchPreviousPage`,
|
||||
`hasNextPage`, `hasPreviousPage`, `isFetchingNextPage`, and `isFetchingPreviousPage`. `data().pages` and
|
||||
`data().pageParams` are also added, as long as a `select` doesn't change `TData` away from its default
|
||||
`InfiniteData<TQueryFnData>` shape.
|
||||
|
||||
### Remarks
|
||||
|
||||
Keep in mind that imperative fetch calls, such as `fetchNextPage`, may interfere with the default
|
||||
refetch behavior, resulting in outdated data. Make sure to call these functions only in response to user
|
||||
actions, or add conditions like `hasNextPage() && !isFetching()`. This is the only overload that accepts
|
||||
`queryFn: skipToken`, shown below.
|
||||
|
||||
### See
|
||||
|
||||
[infiniteQueryOptions](infiniteQueryOptions.md) to share these options between `injectInfiniteQuery` and imperative APIs
|
||||
like `queryClient.fetchInfiniteQuery`.
|
||||
|
||||
### Examples
|
||||
|
||||
Fetching the next page from a button click:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'projects-list',
|
||||
template: `
|
||||
<ul>
|
||||
@for (page of projectsQuery.data()?.pages; track $index) {
|
||||
@for (project of page.projects; track project.id) {
|
||||
<li>{{ project.name }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
<button
|
||||
[disabled]="!projectsQuery.hasNextPage() || projectsQuery.isFetching()"
|
||||
(click)="projectsQuery.fetchNextPage()"
|
||||
>
|
||||
Load More
|
||||
</button>
|
||||
`,
|
||||
})
|
||||
export class ProjectsList {
|
||||
readonly projectsQuery = injectInfiniteQuery(() => ({
|
||||
queryKey: ['projects'],
|
||||
queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a sentinel
|
||||
element after the list:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'projects-list',
|
||||
template: `
|
||||
<ul>
|
||||
@for (page of projectsQuery.data()?.pages; track $index) {
|
||||
@for (project of page.projects; track project.id) {
|
||||
<li>{{ project.name }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
<div #sentinel>{{ projectsQuery.isFetchingNextPage() ? 'Loading more...' : '' }}</div>
|
||||
`,
|
||||
})
|
||||
export class ProjectsList {
|
||||
readonly sentinel = viewChild<ElementRef<HTMLElement>>('sentinel')
|
||||
|
||||
readonly projectsQuery = injectInfiniteQuery(() => ({
|
||||
queryKey: ['projects'],
|
||||
queryFn: ({ pageParam }) => fetchProjects(pageParam),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
}))
|
||||
|
||||
constructor() {
|
||||
effect((onCleanup) => {
|
||||
const sentinel = this.sentinel()?.nativeElement
|
||||
if (
|
||||
sentinel == null ||
|
||||
!this.projectsQuery.hasNextPage() ||
|
||||
this.projectsQuery.isFetching()
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const observer = new IntersectionObserver(([entry]) => {
|
||||
if (entry?.isIntersecting) this.projectsQuery.fetchNextPage()
|
||||
})
|
||||
observer.observe(sentinel)
|
||||
|
||||
onCleanup(() => observer.disconnect())
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A query that's disabled, type safe, until `postId` is set — pass `skipToken` as `queryFn` instead of
|
||||
setting `enabled: false`:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'comments',
|
||||
template: `
|
||||
@if (postId() == null) {
|
||||
Select a post
|
||||
} @else if (commentsQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (commentsQuery.isError()) {
|
||||
<span>Error: {{ commentsQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<ul>
|
||||
@for (page of commentsQuery.data().pages; track $index) {
|
||||
@for (comment of page.comments; track comment.id) {
|
||||
<li>{{ comment.text }}</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Comments {
|
||||
readonly postId = signal<string | undefined>(undefined)
|
||||
|
||||
readonly commentsQuery = injectInfiniteQuery(() => ({
|
||||
queryKey: ['post', this.postId(), 'comments'],
|
||||
queryFn:
|
||||
this.postId() != null
|
||||
? ({ pageParam }) => fetchComments(this.postId()!, pageParam)
|
||||
: skipToken,
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: (lastPage) => lastPage.nextId,
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function injectInfiniteQuery<TQueryFnData, TError, TData, TQueryKey, TPageParam>(injectInfiniteQueryFn, options?): CreateInfiniteQueryResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-infinite-query.ts:267](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-infinite-query.ts#L267)
|
||||
|
||||
This overload accepts the general [CreateInfiniteQueryOptions](../interfaces/CreateInfiniteQueryOptions.md) shape rather than the
|
||||
`initialData`-aware overloads above, so whether `data` is defined can't be inferred from the call site —
|
||||
useful when wrapping `injectInfiniteQuery` in your own helper function that forwards caller-provided
|
||||
options.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `unknown`\>
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
#### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### injectInfiniteQueryFn
|
||||
|
||||
() => [`CreateInfiniteQueryOptions`](../interfaces/CreateInfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>
|
||||
|
||||
A function that returns infinite query options. Similar to `computed` from
|
||||
Angular, this function runs in the reactive context, so signals read inside it drive the query.
|
||||
|
||||
#### options?
|
||||
|
||||
[`InjectInfiniteQueryOptions`](../interfaces/InjectInfiniteQueryOptions.md)
|
||||
|
||||
Additional configuration.
|
||||
|
||||
### Returns
|
||||
|
||||
[`CreateInfiniteQueryResult`](../type-aliases/CreateInfiniteQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
The infinite query result.
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
id: injectIsFetching
|
||||
title: injectIsFetching
|
||||
---
|
||||
|
||||
```ts
|
||||
function injectIsFetching(filters?, options?): Signal<number>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-fetching.ts:63](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-fetching.ts#L63)
|
||||
|
||||
Injects a signal that tracks the number of queries that your application is loading or fetching in the
|
||||
background (useful for app-wide loading indicators).
|
||||
|
||||
## Parameters
|
||||
|
||||
### filters?
|
||||
|
||||
[`QueryFilters`](../interfaces/QueryFilters.md)\<readonly `unknown`[]\>
|
||||
|
||||
The [QueryFilters](../interfaces/QueryFilters.md) to narrow down the matched queries.
|
||||
|
||||
### options?
|
||||
|
||||
[`InjectIsFetchingOptions`](../interfaces/InjectIsFetchingOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
## Returns
|
||||
|
||||
`Signal`\<`number`\>
|
||||
|
||||
A `Signal` with the number of queries that your application is currently loading or fetching in
|
||||
the background.
|
||||
|
||||
## Examples
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'posts-fetching-indicator',
|
||||
template: `
|
||||
@if (isFetchingPosts()) {
|
||||
<span>Refreshing posts...</span>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class PostsFetchingIndicator {
|
||||
// How many queries matching the posts prefix are fetching?
|
||||
readonly isFetchingPosts = injectIsFetching({ queryKey: ['posts'] })
|
||||
}
|
||||
```
|
||||
|
||||
A global loading indicator for any query fetching in the background, not just the ones on screen:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'global-loading-indicator',
|
||||
template: `
|
||||
@if (isFetching()) {
|
||||
<div>Queries are fetching in the background...</div>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class GlobalLoadingIndicator {
|
||||
readonly isFetching = injectIsFetching()
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
id: injectIsMutating
|
||||
title: injectIsMutating
|
||||
---
|
||||
|
||||
```ts
|
||||
function injectIsMutating(filters?, options?): Signal<number>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-mutating.ts:46](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-mutating.ts#L46)
|
||||
|
||||
Injects a signal that tracks the number of mutations that your application currently has `pending`
|
||||
(useful for app-wide loading indicators).
|
||||
|
||||
## Parameters
|
||||
|
||||
### filters?
|
||||
|
||||
[`MutationFilters`](../interfaces/MutationFilters.md)\<`unknown`, `Error`, `unknown`, `unknown`\>
|
||||
|
||||
The [MutationFilters](../interfaces/MutationFilters.md) to narrow down the matched mutations.
|
||||
|
||||
### options?
|
||||
|
||||
[`InjectIsMutatingOptions`](../interfaces/InjectIsMutatingOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
## Returns
|
||||
|
||||
`Signal`\<`number`\>
|
||||
|
||||
A `Signal` with the number of mutations that your application currently has `pending`.
|
||||
|
||||
## Example
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'posts-mutating-indicator',
|
||||
template: `
|
||||
@if (isMutatingPosts()) {
|
||||
<span>Saving posts...</span>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class PostsMutatingIndicator {
|
||||
// How many mutations matching the posts prefix are in progress?
|
||||
readonly isMutatingPosts = injectIsMutating({ mutationKey: ['posts'] })
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
id: injectIsRestoring
|
||||
title: injectIsRestoring
|
||||
---
|
||||
|
||||
```ts
|
||||
function injectIsRestoring(options?): Signal<boolean>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-restoring.ts:35](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-restoring.ts#L35)
|
||||
|
||||
Injects a signal that tracks whether a restore (e.g. from a persisted client, wired up via
|
||||
`provideIsRestoring`) is currently in progress. `injectQuery` and friends also check this internally to
|
||||
avoid race conditions between the restore and initializing queries.
|
||||
|
||||
## Parameters
|
||||
|
||||
### options?
|
||||
|
||||
`InjectIsRestoringOptions`
|
||||
|
||||
Additional configuration
|
||||
|
||||
## Returns
|
||||
|
||||
`Signal`\<`boolean`\>
|
||||
|
||||
A readonly `Signal<boolean>` — `true` while a restore is in progress, `false` otherwise (the
|
||||
default when no `provideIsRestoring` provider is registered).
|
||||
184
docs/framework/angular/reference/functions/injectMutation.md
Normal file
184
docs/framework/angular/reference/functions/injectMutation.md
Normal file
@@ -0,0 +1,184 @@
|
||||
---
|
||||
id: injectMutation
|
||||
title: injectMutation
|
||||
---
|
||||
|
||||
```ts
|
||||
function injectMutation<TData, TError, TVariables, TOnMutateResult>(injectMutationFn, options?): CreateMutationResult<TData, TError, TVariables, TOnMutateResult>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-mutation.ts:174](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-mutation.ts#L174)
|
||||
|
||||
Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
|
||||
`injectMutation` is the function for that. Unlike queries, mutations are not run automatically.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
## Parameters
|
||||
|
||||
### injectMutationFn
|
||||
|
||||
() => [`CreateMutationOptions`](../interfaces/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
A function that returns mutation options. Similar to `computed` from Angular,
|
||||
this function runs in the reactive context, so signals read inside it drive the mutation's options.
|
||||
|
||||
### options?
|
||||
|
||||
[`InjectMutationOptions`](../interfaces/InjectMutationOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
## Returns
|
||||
|
||||
[`CreateMutationResult`](../type-aliases/CreateMutationResult.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>
|
||||
|
||||
The mutation result. Value fields are exposed as a `Signal` — read `data`/`error` by calling them
|
||||
(e.g. `mutation.data()`) — while function fields (`mutate`, `mutateAsync`, `reset`) are called directly,
|
||||
unchanged. `isSuccess`/`isError`/`isPending`/`isIdle` are type-guard methods you can call to narrow whether
|
||||
`data` is defined.
|
||||
|
||||
## Remarks
|
||||
|
||||
`mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a
|
||||
second argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to
|
||||
the shared mutation definition. Callbacks defined in `injectMutationFn` fire for every mutation; per-call
|
||||
callbacks fire only for the latest call you've made — `mutateAsync` gives you a promise per call instead,
|
||||
so you can await `Promise.all`/`Promise.allSettled` over several calls and see each one's outcome.
|
||||
|
||||
## See
|
||||
|
||||
[mutationOptions](mutationOptions.md) to share these options across multiple `injectMutation` call sites, or to look
|
||||
the mutation up elsewhere via its `mutationKey` (e.g. with `injectMutationState`).
|
||||
|
||||
## Examples
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'todos',
|
||||
template: `
|
||||
@if (addMutation.isPending()) {
|
||||
<span>Adding todo...</span>
|
||||
} @else if (addMutation.isError()) {
|
||||
<div>An error occurred: {{ addMutation.error()?.message }}</div>
|
||||
}
|
||||
<button (click)="addMutation.mutate('Item')">Add</button>
|
||||
`,
|
||||
})
|
||||
export class Todos {
|
||||
readonly #queryClient = inject(QueryClient)
|
||||
|
||||
readonly addMutation = injectMutation(() => ({
|
||||
mutationFn: addTodo,
|
||||
onSuccess: () => this.#queryClient.invalidateQueries({ queryKey: ['todos'] }),
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
Optimistic update via `onMutate`, rolling back on `onError`:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'todos',
|
||||
template: `<button (click)="addMutation.mutate('Item')">Add</button>`,
|
||||
})
|
||||
export class Todos {
|
||||
readonly #queryClient = inject(QueryClient)
|
||||
|
||||
readonly addMutation = injectMutation(() => ({
|
||||
mutationFn: addTodo,
|
||||
onMutate: async (newTodo) => {
|
||||
await this.#queryClient.cancelQueries({ queryKey: ['todos'] })
|
||||
const previousTodos = this.#queryClient.getQueryData<Array<string>>(['todos'])
|
||||
|
||||
this.#queryClient.setQueryData<Array<string>>(['todos'], (old) => [
|
||||
...(old ?? []),
|
||||
newTodo,
|
||||
])
|
||||
|
||||
// Passed to `onError` as `onMutateResult` if the mutation fails.
|
||||
return { previousTodos }
|
||||
},
|
||||
onError: (_err, _newTodo, onMutateResult) => {
|
||||
this.#queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)
|
||||
},
|
||||
onSettled: () => {
|
||||
this.#queryClient.invalidateQueries({ queryKey: ['todos'] })
|
||||
},
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a promise per
|
||||
call instead, so you can wait for all of them when they succeed:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'todos',
|
||||
template: `
|
||||
<button (click)="handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])">Add all</button>
|
||||
`,
|
||||
})
|
||||
export class Todos {
|
||||
readonly #queryClient = inject(QueryClient)
|
||||
|
||||
readonly addMutation = injectMutation(() => ({
|
||||
mutationFn: addTodo,
|
||||
onSuccess: () => this.#queryClient.invalidateQueries({ queryKey: ['todos'] }),
|
||||
}))
|
||||
|
||||
async handleAddAll(todos: Array<string>) {
|
||||
try {
|
||||
await Promise.all(todos.map((todo) => this.addMutation.mutateAsync(todo)))
|
||||
} catch (error) {
|
||||
console.error('Failed to add todos:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If some of the mutations above can fail independently of the others, and you want to know which ones did —
|
||||
rather than losing that information the moment the first one rejects — swap `Promise.all` for
|
||||
`Promise.allSettled`:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'todos',
|
||||
template: `
|
||||
<button (click)="handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])">Add all</button>
|
||||
`,
|
||||
})
|
||||
export class Todos {
|
||||
readonly #queryClient = inject(QueryClient)
|
||||
|
||||
readonly addMutation = injectMutation(() => ({
|
||||
mutationFn: addTodo,
|
||||
onSuccess: () => this.#queryClient.invalidateQueries({ queryKey: ['todos'] }),
|
||||
}))
|
||||
|
||||
async handleAddAll(todos: Array<string>) {
|
||||
const addResults = await Promise.allSettled(
|
||||
todos.map((todo) => this.addMutation.mutateAsync(todo)),
|
||||
)
|
||||
|
||||
addResults.forEach((addResult, index) => {
|
||||
if (addResult.status === 'rejected') {
|
||||
console.error(`Failed to add "${todos[index]}":`, addResult.reason)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
id: injectMutationState
|
||||
title: injectMutationState
|
||||
---
|
||||
|
||||
```ts
|
||||
function injectMutationState<TResult>(injectMutationStateFn, options?): Signal<TResult[]>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-mutation-state.ts:106](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-mutation-state.ts#L106)
|
||||
|
||||
Injects a signal that gives you access to all mutations in the `MutationCache`. You can pass `filters`
|
||||
([MutationFilters](../interfaces/MutationFilters.md)) to narrow down your mutations, and `select` to transform the mutation state.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TResult
|
||||
|
||||
`TResult` = [`MutationState`](../interfaces/MutationState.md)\<`unknown`, `Error`, `unknown`, `unknown`\>
|
||||
|
||||
## Parameters
|
||||
|
||||
### injectMutationStateFn
|
||||
|
||||
() => `MutationStateOptions`\<`TResult`\>
|
||||
|
||||
A function returning the `filters` to narrow down matched mutations, and an
|
||||
optional `select` to transform the mutation state. Similar to `computed` from Angular, this function runs
|
||||
in the reactive context, so signals read inside it re-narrow the matched mutations.
|
||||
|
||||
### options?
|
||||
|
||||
[`InjectMutationStateOptions`](../interfaces/InjectMutationStateOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
## Returns
|
||||
|
||||
`Signal`\<`TResult`[]\>
|
||||
|
||||
A `Signal` with an Array of whatever `select` returns for each matching mutation.
|
||||
|
||||
## Examples
|
||||
|
||||
Get all variables of all running mutations:
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'pending-posts',
|
||||
template: `{{ pendingVariables().length }} posts saving...`,
|
||||
})
|
||||
export class PendingPosts {
|
||||
readonly pendingVariables = injectMutationState(() => ({
|
||||
filters: { status: 'pending' },
|
||||
select: (mutation) => mutation.state.variables,
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
Get all data for specific mutations via the `mutationKey`:
|
||||
```angular-ts
|
||||
const mutationKey = ['posts']
|
||||
|
||||
@Component({
|
||||
selector: 'posts',
|
||||
template: `
|
||||
<button (click)="createPost()">
|
||||
Create post ({{ savedPosts().length }} saved so far)
|
||||
</button>
|
||||
`,
|
||||
})
|
||||
export class Posts {
|
||||
// Some mutation that we want to get the state for
|
||||
readonly createPostMutation = injectMutation(() => ({
|
||||
mutationKey,
|
||||
mutationFn: createPosts,
|
||||
}))
|
||||
|
||||
readonly savedPosts = injectMutationState(() => ({
|
||||
// this mutation key needs to match the mutation key of the given mutation (see above)
|
||||
filters: { mutationKey, status: 'success' },
|
||||
select: (mutation) => mutation.state.data,
|
||||
}))
|
||||
|
||||
createPost() {
|
||||
this.createPostMutation.mutate(['New Post'])
|
||||
}
|
||||
}
|
||||
```
|
||||
263
docs/framework/angular/reference/functions/injectQuery.md
Normal file
263
docs/framework/angular/reference/functions/injectQuery.md
Normal file
@@ -0,0 +1,263 @@
|
||||
---
|
||||
id: injectQuery
|
||||
title: injectQuery
|
||||
---
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function injectQuery<TQueryFnData, TError, TData, TQueryKey>(injectQueryFn, options?): DefinedCreateQueryResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-query.ts:69](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query.ts#L69)
|
||||
|
||||
This overload is selected when `initialData` is set on the options returned by `injectQueryFn`, so the
|
||||
resulting `data` signal is never `undefined` (unless a `select` changes `TData` to include `undefined`).
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
### Parameters
|
||||
|
||||
#### injectQueryFn
|
||||
|
||||
() => [`DefinedInitialDataOptions`](../type-aliases/DefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
A function returning the [DefinedInitialDataOptions](../type-aliases/DefinedInitialDataOptions.md) to use — everything you
|
||||
can pass to `injectQuery`, with `initialData` set. Similar to `computed` from Angular, this function runs
|
||||
in the reactive context, so signals read inside it (in `queryKey`, `enabled`, etc.) drive the query.
|
||||
|
||||
#### options?
|
||||
|
||||
[`InjectQueryOptions`](../interfaces/InjectQueryOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
### Returns
|
||||
|
||||
[`DefinedCreateQueryResult`](../type-aliases/DefinedCreateQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
The query result, typed so that `data` is never `undefined` (unless a `select` changes `TData` to
|
||||
include `undefined`).
|
||||
|
||||
### See
|
||||
|
||||
- https://tanstack.com/query/latest/docs/framework/angular/guides/queries
|
||||
- [queryOptions](queryOptions.md) to share these options between `injectQuery` and imperative APIs like
|
||||
`queryClient.fetchQuery`.
|
||||
|
||||
### Example
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'posts',
|
||||
template: `
|
||||
<!-- `postsQuery.data()` is `Post[]`, never `undefined`, thanks to `initialData` — even if a
|
||||
refetch fails, so the list stays visible alongside the error. -->
|
||||
@if (postsQuery.isError()) {
|
||||
<span>Error: {{ postsQuery.error()?.message }}</span>
|
||||
}
|
||||
<ul>
|
||||
@for (post of postsQuery.data(); track post.id) {
|
||||
<li>{{ post.title }}</li>
|
||||
}
|
||||
</ul>
|
||||
`,
|
||||
})
|
||||
export class Posts {
|
||||
readonly postsQuery = injectQuery(() => ({
|
||||
queryKey: ['posts'],
|
||||
queryFn: fetchPosts,
|
||||
initialData: [],
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function injectQuery<TQueryFnData, TError, TData, TQueryKey>(injectQueryFn, options?): CreateQueryResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-query.ts:158](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query.ts#L158)
|
||||
|
||||
Injects a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
### Parameters
|
||||
|
||||
#### injectQueryFn
|
||||
|
||||
() => [`UndefinedInitialDataOptions`](../type-aliases/UndefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
A function returning the [UndefinedInitialDataOptions](../type-aliases/UndefinedInitialDataOptions.md) to use — everything
|
||||
you can pass to `injectQuery`. Similar to `computed` from Angular, this function runs in the reactive
|
||||
context, so signals read inside it (in `queryKey`, `enabled`, etc.) drive the query.
|
||||
|
||||
#### options?
|
||||
|
||||
[`InjectQueryOptions`](../interfaces/InjectQueryOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
### Returns
|
||||
|
||||
[`CreateQueryResult`](../type-aliases/CreateQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
The query result. `status()` is `'pending'` if there is no cached data to display, `'error'` if
|
||||
the last fetch attempt failed, or `'success'` if the query has data to display. `isPending`/`isSuccess`/
|
||||
`isError` are type-guard methods for convenience.
|
||||
|
||||
### See
|
||||
|
||||
- https://tanstack.com/query/latest/docs/framework/angular/guides/queries
|
||||
- [queryOptions](queryOptions.md) to share these options between `injectQuery` and imperative APIs like
|
||||
`queryClient.fetchQuery`.
|
||||
|
||||
### Examples
|
||||
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'posts',
|
||||
template: `
|
||||
@if (postsQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (postsQuery.isError()) {
|
||||
<span>Error: {{ postsQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<ul>
|
||||
@for (post of postsQuery.data(); track post.id) {
|
||||
<li>{{ post.title }}</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Posts {
|
||||
readonly postsQuery = injectQuery(() => ({
|
||||
queryKey: ['posts'],
|
||||
queryFn: fetchPosts,
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
Similar to `computed` from Angular, the function passed to `injectQuery` runs in the reactive context. In
|
||||
the example below, the query is automatically enabled and executed when the filter signal changes to a
|
||||
truthy value. When the filter signal changes back to a falsy value, the query is disabled.
|
||||
```angular-ts
|
||||
@Component({
|
||||
selector: 'posts',
|
||||
template: `
|
||||
<input [ngModel]="filter()" (ngModelChange)="filter.set($event)" />
|
||||
@if (postsQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (postsQuery.isError()) {
|
||||
<span>Error: {{ postsQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<ul>
|
||||
@for (post of postsQuery.data(); track post.id) {
|
||||
<li>{{ post.title }}</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Posts {
|
||||
readonly filter = signal('')
|
||||
|
||||
readonly postsQuery = injectQuery(() => ({
|
||||
queryKey: ['posts', this.filter()],
|
||||
queryFn: () => fetchPosts(this.filter()),
|
||||
// Signals can be combined with expressions
|
||||
enabled: !!this.filter(),
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function injectQuery<TQueryFnData, TError, TData, TQueryKey>(injectQueryFn, options?): CreateQueryResult<TData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-query.ts:185](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query.ts#L185)
|
||||
|
||||
This overload accepts the general [CreateQueryOptions](../interfaces/CreateQueryOptions.md) shape rather than the `initialData`-aware
|
||||
overloads above, so whether `data` is defined can't be inferred from the call site — useful when wrapping
|
||||
`injectQuery` in your own helper function that forwards caller-provided options.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
### Parameters
|
||||
|
||||
#### injectQueryFn
|
||||
|
||||
() => [`CreateQueryOptions`](../interfaces/CreateQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
A function that returns query options. Similar to `computed` from Angular, this
|
||||
function runs in the reactive context, so signals read inside it (in `queryKey`, `enabled`, etc.) drive
|
||||
the query.
|
||||
|
||||
#### options?
|
||||
|
||||
[`InjectQueryOptions`](../interfaces/InjectQueryOptions.md)
|
||||
|
||||
Additional configuration
|
||||
|
||||
### Returns
|
||||
|
||||
[`CreateQueryResult`](../type-aliases/CreateQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
The query result.
|
||||
|
||||
### See
|
||||
|
||||
https://tanstack.com/query/latest/docs/framework/angular/guides/queries
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
id: injectQueryClient
|
||||
title: injectQueryClient
|
||||
---
|
||||
|
||||
```ts
|
||||
function injectQueryClient(injectOptions): QueryClient;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-query-client.ts:18](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query-client.ts#L18)
|
||||
|
||||
Injects a `QueryClient` instance and allows passing a custom injector.
|
||||
|
||||
## Parameters
|
||||
|
||||
### injectOptions
|
||||
|
||||
`InjectOptions` & `object` = `{}`
|
||||
|
||||
Type of the options argument to inject and optionally a custom injector.
|
||||
|
||||
## Returns
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md)
|
||||
|
||||
The `QueryClient` instance.
|
||||
|
||||
## Deprecated
|
||||
|
||||
Use `inject(QueryClient)` instead.
|
||||
If you need to get a `QueryClient` from a custom injector, use `injector.get(QueryClient)`.
|
||||
|
||||
**Example**
|
||||
```ts
|
||||
const queryClient = injectQueryClient();
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
id: isCancelledError
|
||||
title: isCancelledError
|
||||
---
|
||||
|
||||
```ts
|
||||
function isCancelledError(value): value is CancelledError;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/retryer.ts:90](https://github.com/TanStack/query/blob/main/packages/query-core/src/retryer.ts#L90)
|
||||
|
||||
## Parameters
|
||||
|
||||
### value
|
||||
|
||||
`any`
|
||||
|
||||
## Returns
|
||||
|
||||
`value is CancelledError`
|
||||
|
||||
## Deprecated
|
||||
|
||||
Use instanceof `CancelledError` instead.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
id: keepPreviousData
|
||||
title: keepPreviousData
|
||||
---
|
||||
|
||||
```ts
|
||||
function keepPreviousData<T>(previousData): T | undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:493](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L493)
|
||||
|
||||
Intended to be passed as a query's `placeholderData` option, for example
|
||||
`placeholderData: keepPreviousData`. Instead of resetting the query's data to `undefined` while a new
|
||||
query key is fetching, it keeps displaying the previously fetched data until the new data arrives.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### T
|
||||
|
||||
`T`
|
||||
|
||||
## Parameters
|
||||
|
||||
### previousData
|
||||
|
||||
`T` | `undefined`
|
||||
|
||||
## Returns
|
||||
|
||||
`T` \| `undefined`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
new QueryObserver(queryClient, {
|
||||
queryKey: ['posts', page],
|
||||
queryFn: () => fetchPosts(page),
|
||||
placeholderData: keepPreviousData,
|
||||
})
|
||||
```
|
||||
38
docs/framework/angular/reference/functions/matchMutation.md
Normal file
38
docs/framework/angular/reference/functions/matchMutation.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
id: matchMutation
|
||||
title: matchMutation
|
||||
---
|
||||
|
||||
```ts
|
||||
function matchMutation(filters, mutation): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:237](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L237)
|
||||
|
||||
Checks whether a mutation matches the given [MutationFilters](../interfaces/MutationFilters.md).
|
||||
Every filter that is specified must match; filters that are left unspecified are ignored.
|
||||
If a `mutationKey` filter is provided but the mutation has no `mutationKey` of its own, it does not match.
|
||||
|
||||
## Parameters
|
||||
|
||||
### filters
|
||||
|
||||
[`MutationFilters`](../interfaces/MutationFilters.md)
|
||||
|
||||
### mutation
|
||||
|
||||
[`Mutation`](../classes/Mutation.md)\<`any`, `any`\>
|
||||
|
||||
## Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const mutationCache = queryClient.getMutationCache()
|
||||
|
||||
const matchingMutations = mutationCache
|
||||
.getAll()
|
||||
.filter((mutation) => matchMutation({ mutationKey: ['addPost'] }, mutation))
|
||||
```
|
||||
37
docs/framework/angular/reference/functions/matchQuery.md
Normal file
37
docs/framework/angular/reference/functions/matchQuery.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
id: matchQuery
|
||||
title: matchQuery
|
||||
---
|
||||
|
||||
```ts
|
||||
function matchQuery(filters, query): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:175](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L175)
|
||||
|
||||
Checks whether a query matches the given [QueryFilters](../interfaces/QueryFilters.md).
|
||||
Every filter that is specified must match; filters that are left unspecified are ignored.
|
||||
|
||||
## Parameters
|
||||
|
||||
### filters
|
||||
|
||||
[`QueryFilters`](../interfaces/QueryFilters.md)
|
||||
|
||||
### query
|
||||
|
||||
[`Query`](../classes/Query.md)\<`any`, `any`, `any`, `any`\>
|
||||
|
||||
## Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const queryCache = queryClient.getQueryCache()
|
||||
|
||||
const matchingQueries = queryCache
|
||||
.getAll()
|
||||
.filter((query) => matchQuery({ queryKey: ['posts'] }, query))
|
||||
```
|
||||
167
docs/framework/angular/reference/functions/mutationOptions.md
Normal file
167
docs/framework/angular/reference/functions/mutationOptions.md
Normal file
@@ -0,0 +1,167 @@
|
||||
---
|
||||
id: mutationOptions
|
||||
title: mutationOptions
|
||||
---
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function mutationOptions<TData, TError, TVariables, TOnMutateResult>(options): WithRequired<CreateMutationOptions<TData, TError, TVariables, TOnMutateResult>, "mutationKey">;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/mutation-options.ts:40](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/mutation-options.ts#L40)
|
||||
|
||||
You can generally pass everything to `mutationOptions` that you can also pass to `injectMutation`. A
|
||||
`mutationKey` is required on this overload so the mutation can be looked up later, e.g. with
|
||||
`injectMutationState`.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
#### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`WithRequired`](../type-aliases/WithRequired.md)\<[`CreateMutationOptions`](../interfaces/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `"mutationKey"`\>
|
||||
|
||||
The mutation options to use, identical to what you'd pass to `injectMutation`, with a
|
||||
required `mutationKey`.
|
||||
|
||||
### Returns
|
||||
|
||||
[`WithRequired`](../type-aliases/WithRequired.md)\<[`CreateMutationOptions`](../interfaces/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `"mutationKey"`\>
|
||||
|
||||
The same options object, unchanged.
|
||||
|
||||
### See
|
||||
|
||||
[injectMutation](injectMutation.md) to run the mutation these options describe.
|
||||
|
||||
### Example
|
||||
|
||||
Looking the mutation up elsewhere via its `mutationKey`, e.g. for a global "saving…" indicator:
|
||||
```angular-ts
|
||||
import { mutationOptions, injectMutationState } from '@tanstack/angular-query-experimental'
|
||||
|
||||
const createPostOptions = mutationOptions({
|
||||
mutationKey: ['posts', 'create'],
|
||||
mutationFn: createPost,
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'saving-indicator',
|
||||
template: `
|
||||
@if (isCreatingPost()) {
|
||||
<span>Saving…</span>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class SavingIndicator {
|
||||
readonly #pendingCreates = injectMutationState(() => ({
|
||||
filters: { mutationKey: createPostOptions.mutationKey, status: 'pending' },
|
||||
}))
|
||||
readonly isCreatingPost = computed(() => this.#pendingCreates().length > 0)
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function mutationOptions<TData, TError, TVariables, TOnMutateResult>(options): Omit<CreateMutationOptions<TData, TError, TVariables, TOnMutateResult>, "mutationKey">;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/mutation-options.ts:98](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/mutation-options.ts#L98)
|
||||
|
||||
You can generally pass everything to `mutationOptions` that you can also pass to `injectMutation`. No
|
||||
`mutationKey` is required on this overload — use this when you don't need to target the mutation via a
|
||||
`mutationKey` filter later (e.g. with `injectMutationState`); it can still be observed through other
|
||||
filters, such as `status`.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
#### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
`Omit`\<[`CreateMutationOptions`](../interfaces/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `"mutationKey"`\>
|
||||
|
||||
The mutation options to use, identical to what you'd pass to `injectMutation`, without a
|
||||
`mutationKey`.
|
||||
|
||||
### Returns
|
||||
|
||||
`Omit`\<[`CreateMutationOptions`](../interfaces/CreateMutationOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `"mutationKey"`\>
|
||||
|
||||
The same options object, unchanged.
|
||||
|
||||
### See
|
||||
|
||||
[injectMutation](injectMutation.md) to run the mutation these options describe.
|
||||
|
||||
### Remarks
|
||||
|
||||
See the other overload's example for looking a mutation up via `injectMutationState`.
|
||||
|
||||
### Example
|
||||
|
||||
Sharing options across services, so `QueriesService` stays the single place a mutation is defined:
|
||||
```angular-ts
|
||||
import { mutationOptions, injectMutation } from '@tanstack/angular-query-experimental'
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class QueriesService {
|
||||
readonly #queryClient = inject(QueryClient)
|
||||
|
||||
updatePost(id: number) {
|
||||
return mutationOptions({
|
||||
mutationFn: (post: Partial<Post>) => putPost(id, post),
|
||||
onSuccess: (newPost) => this.#queryClient.setQueryData(['posts', id], newPost),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'post',
|
||||
template: `<button (click)="save()">Save</button>`,
|
||||
})
|
||||
export class Post {
|
||||
readonly queries = inject(QueriesService)
|
||||
readonly id = signal(0)
|
||||
readonly updatePostMutation = injectMutation(() => this.queries.updatePost(this.id()))
|
||||
|
||||
save() {
|
||||
this.updatePostMutation.mutate({ title: 'New Title' })
|
||||
}
|
||||
}
|
||||
```
|
||||
32
docs/framework/angular/reference/functions/noop.md
Normal file
32
docs/framework/angular/reference/functions/noop.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
id: noop
|
||||
title: noop
|
||||
---
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function noop(): void;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:119](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L119)
|
||||
|
||||
A function that does nothing.
|
||||
|
||||
### Returns
|
||||
|
||||
`void`
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function noop(): undefined;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:120](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L120)
|
||||
|
||||
A function that does nothing.
|
||||
|
||||
### Returns
|
||||
|
||||
`undefined`
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
id: partialMatchKey
|
||||
title: partialMatchKey
|
||||
---
|
||||
|
||||
```ts
|
||||
function partialMatchKey(a, b): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:300](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L300)
|
||||
|
||||
Checks if key `b` partially matches with key `a`.
|
||||
|
||||
## Parameters
|
||||
|
||||
### a
|
||||
|
||||
readonly `unknown`[]
|
||||
|
||||
### b
|
||||
|
||||
readonly `unknown`[]
|
||||
|
||||
## Returns
|
||||
|
||||
`boolean`
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
id: provideAngularQuery
|
||||
title: provideAngularQuery
|
||||
---
|
||||
|
||||
```ts
|
||||
function provideAngularQuery(queryClient): Provider[];
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:121](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L121)
|
||||
|
||||
Sets up providers necessary to enable TanStack Query functionality for Angular applications.
|
||||
|
||||
Allows configuring a `QueryClient`.
|
||||
|
||||
## Parameters
|
||||
|
||||
### queryClient
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md)
|
||||
|
||||
A `QueryClient` instance.
|
||||
|
||||
## Returns
|
||||
|
||||
`Provider`[]
|
||||
|
||||
A set of providers to set up TanStack Query.
|
||||
|
||||
## See
|
||||
|
||||
https://tanstack.com/query/v5/docs/framework/angular/quick-start
|
||||
|
||||
## Deprecated
|
||||
|
||||
Use `provideTanStackQuery` instead.
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
id: provideIsRestoring
|
||||
title: provideIsRestoring
|
||||
---
|
||||
|
||||
```ts
|
||||
function provideIsRestoring(isRestoring): Provider;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-restoring.ts:48](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-restoring.ts#L48)
|
||||
|
||||
Registers a provider for the restore state read by `injectIsRestoring`. Wire this up wherever you drive a
|
||||
restore yourself — e.g. a persist-client integration — so `injectQuery` and friends can defer subscribing
|
||||
to their observer (avoiding a race with the restore) until the restore signal flips back to `false`.
|
||||
|
||||
## Parameters
|
||||
|
||||
### isRestoring
|
||||
|
||||
`Signal`\<`boolean`\>
|
||||
|
||||
A readonly `Signal<boolean>` that tracks the restore state.
|
||||
|
||||
## Returns
|
||||
|
||||
`Provider`
|
||||
|
||||
A provider for the `isRestoring` signal.
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
id: provideQueryClient
|
||||
title: provideQueryClient
|
||||
---
|
||||
|
||||
```ts
|
||||
function provideQueryClient(queryClient): Provider;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:22](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L22)
|
||||
|
||||
Usually [provideTanStackQuery](provideTanStackQuery.md) is used once to set up TanStack Query and the
|
||||
[`QueryClient`](https://tanstack.com/query/latest/docs/reference/QueryClient) for the entire application —
|
||||
it calls `provideQueryClient` internally. Use `provideQueryClient` directly to provide a different
|
||||
`QueryClient` instance for part of the application, or for unit testing.
|
||||
|
||||
## Parameters
|
||||
|
||||
### queryClient
|
||||
|
||||
A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md) | `InjectionToken`\<[`QueryClient`](../classes/QueryClient.md)\>
|
||||
|
||||
## Returns
|
||||
|
||||
`Provider`
|
||||
|
||||
A provider object that can be used to provide the `QueryClient` instance.
|
||||
|
||||
## Example
|
||||
|
||||
Providing a test-only `QueryClient` in a component test, without wiring up `provideTanStackQuery`'s other
|
||||
defaults:
|
||||
```ts
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideQueryClient(new QueryClient())],
|
||||
})
|
||||
```
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
id: provideTanStackQuery
|
||||
title: provideTanStackQuery
|
||||
---
|
||||
|
||||
```ts
|
||||
function provideTanStackQuery(queryClient, ...features): Provider[];
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:102](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L102)
|
||||
|
||||
Sets up providers necessary to enable TanStack Query functionality for Angular applications. Allows
|
||||
configuring a `QueryClient` and optional features such as developer tools.
|
||||
|
||||
## Parameters
|
||||
|
||||
### queryClient
|
||||
|
||||
A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md) | `InjectionToken`\<[`QueryClient`](../classes/QueryClient.md)\>
|
||||
|
||||
### features
|
||||
|
||||
...[`QueryFeatures`](../type-aliases/QueryFeatures.md)[]
|
||||
|
||||
Optional features to configure additional Query functionality.
|
||||
|
||||
## Returns
|
||||
|
||||
`Provider`[]
|
||||
|
||||
A set of providers to set up TanStack Query.
|
||||
|
||||
## See
|
||||
|
||||
- https://tanstack.com/query/v5/docs/framework/angular/quick-start
|
||||
- withDevtools
|
||||
|
||||
## Examples
|
||||
|
||||
```ts
|
||||
import { provideTanStackQuery, QueryClient } from '@tanstack/angular-query-experimental'
|
||||
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [provideTanStackQuery(new QueryClient())],
|
||||
})
|
||||
```
|
||||
|
||||
The same, in an `NgModule`-based application:
|
||||
```ts
|
||||
import { provideTanStackQuery, QueryClient } from '@tanstack/angular-query-experimental'
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
imports: [BrowserModule],
|
||||
providers: [provideTanStackQuery(new QueryClient())],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {}
|
||||
```
|
||||
|
||||
Enabling optional developer tools by adding `withDevtools` — by default, the tools are then loaded when
|
||||
your app is in development mode:
|
||||
```ts
|
||||
import {
|
||||
provideTanStackQuery,
|
||||
withDevtools,
|
||||
QueryClient,
|
||||
} from '@tanstack/angular-query-experimental'
|
||||
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [provideTanStackQuery(new QueryClient(), withDevtools())],
|
||||
})
|
||||
```
|
||||
|
||||
Using an `InjectionToken` for the `QueryClient` — an advanced optimization that lets TanStack Query be
|
||||
absent from the main application bundle, useful for including it on lazy-loaded routes only while still
|
||||
sharing a `QueryClient`. This is a small optimization; for most applications it's preferable to provide
|
||||
the `QueryClient` in the main application config, as in the examples above:
|
||||
```ts
|
||||
export const MY_QUERY_CLIENT = new InjectionToken('', {
|
||||
factory: () => new QueryClient(),
|
||||
})
|
||||
|
||||
// In a lazy loaded route or lazy loaded component's providers array:
|
||||
providers: [provideTanStackQuery(MY_QUERY_CLIENT)]
|
||||
```
|
||||
38
docs/framework/angular/reference/functions/queryFeature.md
Normal file
38
docs/framework/angular/reference/functions/queryFeature.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
id: queryFeature
|
||||
title: queryFeature
|
||||
---
|
||||
|
||||
```ts
|
||||
function queryFeature<TFeatureKind>(kind, providers): QueryFeature<TFeatureKind>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:143](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L143)
|
||||
|
||||
Helper function to create an object that represents a Query feature.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TFeatureKind
|
||||
|
||||
`TFeatureKind` *extends* `"Devtools"` \| `"PersistQueryClient"`
|
||||
|
||||
## Parameters
|
||||
|
||||
### kind
|
||||
|
||||
`TFeatureKind`
|
||||
|
||||
The kind of feature, e.g. `'Devtools'`.
|
||||
|
||||
### providers
|
||||
|
||||
`Provider`[]
|
||||
|
||||
The Angular providers this feature contributes to `provideTanStackQuery`.
|
||||
|
||||
## Returns
|
||||
|
||||
[`QueryFeature`](../interfaces/QueryFeature.md)\<`TFeatureKind`\>
|
||||
|
||||
A Query feature.
|
||||
274
docs/framework/angular/reference/functions/queryOptions.md
Normal file
274
docs/framework/angular/reference/functions/queryOptions.md
Normal file
@@ -0,0 +1,274 @@
|
||||
---
|
||||
id: queryOptions
|
||||
title: queryOptions
|
||||
---
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function queryOptions<TQueryFnData, TError, TData, TQueryKey>(options): Omit<CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>, "queryFn"> & object & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/query-options.ts:151](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/query-options.ts#L151)
|
||||
|
||||
You can generally pass everything to `queryOptions` that you can also pass to `injectQuery`. These options
|
||||
can be shared across functions and imperative APIs such as `queryClient.fetchQuery`. `options.queryKey` is
|
||||
required and is the query key to generate options for.
|
||||
|
||||
This overload is selected when `initialData` is set, so the resulting `data` is never `undefined` (unless
|
||||
a `select` changes `TData` to include `undefined`).
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`DefinedInitialDataOptions`](../type-aliases/DefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
The [DefinedInitialDataOptions](../type-aliases/DefinedInitialDataOptions.md) to use — everything you can pass to `injectQuery`,
|
||||
with `initialData` set.
|
||||
|
||||
### Returns
|
||||
|
||||
The same options object, typed so that `queryKey` carries the inferred data type.
|
||||
|
||||
### See
|
||||
|
||||
- [injectQuery](injectQuery.md) to run a query with these options.
|
||||
- [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.
|
||||
|
||||
### Example
|
||||
|
||||
```angular-ts
|
||||
import { queryOptions, injectQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const postsOptions = queryOptions({
|
||||
queryKey: ['posts'],
|
||||
queryFn: fetchPosts,
|
||||
initialData: [],
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'posts',
|
||||
template: `
|
||||
<!-- `postsQuery.data()` is never `undefined`, thanks to `initialData` — even if a refetch
|
||||
fails, so the list stays visible alongside the error. -->
|
||||
@if (postsQuery.isError()) {
|
||||
<span>Error: {{ postsQuery.error()?.message }}</span>
|
||||
}
|
||||
<ul>
|
||||
@for (post of postsQuery.data(); track post.id) {
|
||||
<li>{{ post.title }}</li>
|
||||
}
|
||||
</ul>
|
||||
`,
|
||||
})
|
||||
export class Posts {
|
||||
readonly postsQuery = injectQuery(() => postsOptions)
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function queryOptions<TQueryFnData, TError, TData, TQueryKey>(options): OmitKeyof<CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>, "queryFn"> & object & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/query-options.ts:200](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/query-options.ts#L200)
|
||||
|
||||
You can generally pass everything to `queryOptions` that you can also pass to `injectQuery`. These options
|
||||
can be shared across functions and imperative APIs such as `queryClient.fetchQuery`. `options.queryKey` is
|
||||
required and is the query key to generate options for.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`UnusedSkipTokenOptions`](../type-aliases/UnusedSkipTokenOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
The [UnusedSkipTokenOptions](../type-aliases/UnusedSkipTokenOptions.md) to use — everything you can pass to `injectQuery`.
|
||||
|
||||
### Returns
|
||||
|
||||
The same options object, typed so that `queryKey` carries the inferred data type.
|
||||
|
||||
### See
|
||||
|
||||
- [injectQuery](injectQuery.md) to run a query with these options.
|
||||
- [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.
|
||||
|
||||
### Example
|
||||
|
||||
A parameterized factory, so the same options object can be reused per `id`:
|
||||
```angular-ts
|
||||
import { queryOptions, injectQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const postOptions = (id: string) =>
|
||||
queryOptions({
|
||||
queryKey: ['post', id],
|
||||
queryFn: () => fetchPost(id),
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'post',
|
||||
template: `
|
||||
@if (postQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (postQuery.isError()) {
|
||||
<span>Error: {{ postQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<h1>{{ postQuery.data().title }}</h1>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Post {
|
||||
readonly id = signal('1')
|
||||
readonly postQuery = injectQuery(() => postOptions(this.id()))
|
||||
}
|
||||
```
|
||||
|
||||
## Call Signature
|
||||
|
||||
```ts
|
||||
function queryOptions<TQueryFnData, TError, TData, TQueryKey>(options): CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & object & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/query-options.ts:281](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/query-options.ts#L281)
|
||||
|
||||
You can generally pass everything to `queryOptions` that you can also pass to `injectQuery`. These options
|
||||
can be shared across functions and imperative APIs such as `queryClient.fetchQuery`. `options.queryKey` is
|
||||
required and is the query key to generate options for.
|
||||
|
||||
### Type Parameters
|
||||
|
||||
#### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
#### TError
|
||||
|
||||
`TError` = `Error`
|
||||
|
||||
#### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
#### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* readonly `unknown`[] = readonly `unknown`[]
|
||||
|
||||
### Parameters
|
||||
|
||||
#### options
|
||||
|
||||
[`UndefinedInitialDataOptions`](../type-aliases/UndefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\>
|
||||
|
||||
The [UndefinedInitialDataOptions](../type-aliases/UndefinedInitialDataOptions.md) to use — everything you can pass to `injectQuery`.
|
||||
|
||||
### Returns
|
||||
|
||||
The same options object, typed so that `queryKey` carries the inferred data type.
|
||||
|
||||
### See
|
||||
|
||||
- [injectQuery](injectQuery.md) to run a query with these options.
|
||||
- [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern.
|
||||
|
||||
### Remarks
|
||||
|
||||
This is the only overload that accepts `queryFn: skipToken`, shown below.
|
||||
|
||||
### Examples
|
||||
|
||||
A parameterized factory, so the same options object can be reused per `id`:
|
||||
```angular-ts
|
||||
import { queryOptions, injectQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const postOptions = (id: string) =>
|
||||
queryOptions({
|
||||
queryKey: ['post', id],
|
||||
queryFn: () => fetchPost(id),
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'post',
|
||||
template: `
|
||||
@if (postQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (postQuery.isError()) {
|
||||
<span>Error: {{ postQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<h1>{{ postQuery.data().title }}</h1>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Post {
|
||||
readonly id = signal('1')
|
||||
readonly postQuery = injectQuery(() => postOptions(this.id()))
|
||||
}
|
||||
```
|
||||
|
||||
A factory that disables the query, type safe, until `postId` is set:
|
||||
```angular-ts
|
||||
import { queryOptions, skipToken, injectQuery } from '@tanstack/angular-query-experimental'
|
||||
|
||||
export const postOptions = (postId: number | undefined) =>
|
||||
queryOptions({
|
||||
queryKey: ['post', postId],
|
||||
queryFn: postId != null ? () => fetchPost(postId) : skipToken,
|
||||
})
|
||||
|
||||
@Component({
|
||||
selector: 'post',
|
||||
template: `
|
||||
@if (postId() == null) {
|
||||
Select a post
|
||||
} @else if (postQuery.isPending()) {
|
||||
Loading...
|
||||
} @else if (postQuery.isError()) {
|
||||
<span>Error: {{ postQuery.error()?.message }}</span>
|
||||
} @else {
|
||||
<h1>{{ postQuery.data().title }}</h1>
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class Post {
|
||||
readonly postId = signal<number | undefined>(undefined)
|
||||
readonly postQuery = injectQuery(() => postOptions(this.postId()))
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
id: replaceEqualDeep
|
||||
title: replaceEqualDeep
|
||||
---
|
||||
|
||||
```ts
|
||||
function replaceEqualDeep<T>(
|
||||
a,
|
||||
b,
|
||||
depth?): T;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:339](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L339)
|
||||
|
||||
This function returns `a` if `b` is deeply equal.
|
||||
If not, it will replace any deeply equal children of `b` with those of `a`.
|
||||
This can be used for structural sharing between JSON values for example.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### T
|
||||
|
||||
`T`
|
||||
|
||||
## Parameters
|
||||
|
||||
### a
|
||||
|
||||
`unknown`
|
||||
|
||||
### b
|
||||
|
||||
`T`
|
||||
|
||||
### depth?
|
||||
|
||||
`number`
|
||||
|
||||
## Returns
|
||||
|
||||
`T`
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
id: shouldThrowError
|
||||
title: shouldThrowError
|
||||
---
|
||||
|
||||
```ts
|
||||
function shouldThrowError<T>(throwOnError, params): boolean;
|
||||
```
|
||||
|
||||
Defined in: [packages/query-core/src/utils.ts:576](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L576)
|
||||
|
||||
Resolves a `throwOnError` option to a boolean.
|
||||
If `throwOnError` is a function, it is called with `params` (e.g. the error and, depending on the caller,
|
||||
additional context such as the query or mutation) and its result is returned, allowing the throwing
|
||||
behavior to be decided per error. Otherwise, `throwOnError` itself is coerced to a boolean (`undefined`
|
||||
resolves to `false`).
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### T
|
||||
|
||||
`T` *extends* (...`args`) => `boolean`
|
||||
|
||||
## Parameters
|
||||
|
||||
### throwOnError
|
||||
|
||||
`boolean` | `T` | `undefined`
|
||||
|
||||
### params
|
||||
|
||||
`Parameters`\<`T`\>
|
||||
|
||||
## Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const throwOnError =
|
||||
query.state.error && typeof options.throwOnError === 'function'
|
||||
? shouldThrowError(options.throwOnError, [query.state.error, query])
|
||||
: options.throwOnError
|
||||
```
|
||||
221
docs/framework/angular/reference/index.md
Normal file
221
docs/framework/angular/reference/index.md
Normal file
@@ -0,0 +1,221 @@
|
||||
---
|
||||
id: "@tanstack/angular-query-experimental"
|
||||
title: "@tanstack/angular-query-experimental"
|
||||
---
|
||||
|
||||
## Classes
|
||||
|
||||
- [CancelledError](classes/CancelledError.md)
|
||||
- [InfiniteQueryObserver](classes/InfiniteQueryObserver.md)
|
||||
- [Mutation](classes/Mutation.md)
|
||||
- [MutationCache](classes/MutationCache.md)
|
||||
- [MutationObserver](classes/MutationObserver.md)
|
||||
- [QueriesObserver](classes/QueriesObserver.md)
|
||||
- [Query](classes/Query.md)
|
||||
- [QueryCache](classes/QueryCache.md)
|
||||
- [QueryClient](classes/QueryClient.md)
|
||||
- [QueryObserver](classes/QueryObserver.md)
|
||||
|
||||
## Interfaces
|
||||
|
||||
- [BaseMutationNarrowing](interfaces/BaseMutationNarrowing.md)
|
||||
- [BaseQueryNarrowing](interfaces/BaseQueryNarrowing.md)
|
||||
- [CancelOptions](interfaces/CancelOptions.md)
|
||||
- [CreateBaseQueryOptions](interfaces/CreateBaseQueryOptions.md)
|
||||
- [CreateInfiniteQueryOptions](interfaces/CreateInfiniteQueryOptions.md)
|
||||
- [CreateMutationOptions](interfaces/CreateMutationOptions.md)
|
||||
- [CreateQueryOptions](interfaces/CreateQueryOptions.md)
|
||||
- [DefaultOptions](interfaces/DefaultOptions.md)
|
||||
- [DehydratedState](interfaces/DehydratedState.md)
|
||||
- [DehydrateOptions](interfaces/DehydrateOptions.md)
|
||||
- [~~EnsureQueryDataOptions~~](interfaces/EnsureQueryDataOptions.md)
|
||||
- [FetchNextPageOptions](interfaces/FetchNextPageOptions.md)
|
||||
- [FetchPreviousPageOptions](interfaces/FetchPreviousPageOptions.md)
|
||||
- [~~FetchQueryOptions~~](interfaces/FetchQueryOptions.md)
|
||||
- [FocusManager](interfaces/FocusManager.md)
|
||||
- [HydrateOptions](interfaces/HydrateOptions.md)
|
||||
- [InfiniteData](interfaces/InfiniteData.md)
|
||||
- [InfiniteQueryObserverBaseResult](interfaces/InfiniteQueryObserverBaseResult.md)
|
||||
- [InfiniteQueryObserverLoadingErrorResult](interfaces/InfiniteQueryObserverLoadingErrorResult.md)
|
||||
- [InfiniteQueryObserverLoadingResult](interfaces/InfiniteQueryObserverLoadingResult.md)
|
||||
- [InfiniteQueryObserverOptions](interfaces/InfiniteQueryObserverOptions.md)
|
||||
- [InfiniteQueryObserverPendingResult](interfaces/InfiniteQueryObserverPendingResult.md)
|
||||
- [InfiniteQueryObserverPlaceholderResult](interfaces/InfiniteQueryObserverPlaceholderResult.md)
|
||||
- [InfiniteQueryObserverRefetchErrorResult](interfaces/InfiniteQueryObserverRefetchErrorResult.md)
|
||||
- [InfiniteQueryObserverSuccessResult](interfaces/InfiniteQueryObserverSuccessResult.md)
|
||||
- [InfiniteQueryPageParamsOptions](interfaces/InfiniteQueryPageParamsOptions.md)
|
||||
- [InitialPageParam](interfaces/InitialPageParam.md)
|
||||
- [InjectInfiniteQueryOptions](interfaces/InjectInfiniteQueryOptions.md)
|
||||
- [InjectIsFetchingOptions](interfaces/InjectIsFetchingOptions.md)
|
||||
- [InjectIsMutatingOptions](interfaces/InjectIsMutatingOptions.md)
|
||||
- [InjectMutationOptions](interfaces/InjectMutationOptions.md)
|
||||
- [InjectMutationStateOptions](interfaces/InjectMutationStateOptions.md)
|
||||
- [InjectQueryOptions](interfaces/InjectQueryOptions.md)
|
||||
- [InvalidateOptions](interfaces/InvalidateOptions.md)
|
||||
- [InvalidateQueryFilters](interfaces/InvalidateQueryFilters.md)
|
||||
- [MutateOptions](interfaces/MutateOptions.md)
|
||||
- [MutationCacheConfig](interfaces/MutationCacheConfig.md)
|
||||
- [MutationFilters](interfaces/MutationFilters.md)
|
||||
- [MutationObserverBaseResult](interfaces/MutationObserverBaseResult.md)
|
||||
- [MutationObserverErrorResult](interfaces/MutationObserverErrorResult.md)
|
||||
- [MutationObserverIdleResult](interfaces/MutationObserverIdleResult.md)
|
||||
- [MutationObserverLoadingResult](interfaces/MutationObserverLoadingResult.md)
|
||||
- [MutationObserverOptions](interfaces/MutationObserverOptions.md)
|
||||
- [MutationObserverSuccessResult](interfaces/MutationObserverSuccessResult.md)
|
||||
- [MutationOptions](interfaces/MutationOptions.md)
|
||||
- [MutationState](interfaces/MutationState.md)
|
||||
- [NotifyEvent](interfaces/NotifyEvent.md)
|
||||
- [OnlineManager](interfaces/OnlineManager.md)
|
||||
- [QueriesObserverOptions](interfaces/QueriesObserverOptions.md)
|
||||
- [QueryCacheConfig](interfaces/QueryCacheConfig.md)
|
||||
- [QueryClientConfig](interfaces/QueryClientConfig.md)
|
||||
- [QueryExecuteOptions](interfaces/QueryExecuteOptions.md)
|
||||
- [QueryFeature](interfaces/QueryFeature.md)
|
||||
- [QueryFilters](interfaces/QueryFilters.md)
|
||||
- [QueryObserverBaseResult](interfaces/QueryObserverBaseResult.md)
|
||||
- [QueryObserverLoadingErrorResult](interfaces/QueryObserverLoadingErrorResult.md)
|
||||
- [QueryObserverLoadingResult](interfaces/QueryObserverLoadingResult.md)
|
||||
- [QueryObserverOptions](interfaces/QueryObserverOptions.md)
|
||||
- [QueryObserverPendingResult](interfaces/QueryObserverPendingResult.md)
|
||||
- [QueryObserverPlaceholderResult](interfaces/QueryObserverPlaceholderResult.md)
|
||||
- [QueryObserverRefetchErrorResult](interfaces/QueryObserverRefetchErrorResult.md)
|
||||
- [QueryObserverSuccessResult](interfaces/QueryObserverSuccessResult.md)
|
||||
- [QueryOptions](interfaces/QueryOptions.md)
|
||||
- [QueryState](interfaces/QueryState.md)
|
||||
- [RefetchOptions](interfaces/RefetchOptions.md)
|
||||
- [RefetchQueryFilters](interfaces/RefetchQueryFilters.md)
|
||||
- [Register](interfaces/Register.md)
|
||||
- [ResetOptions](interfaces/ResetOptions.md)
|
||||
- [ResultOptions](interfaces/ResultOptions.md)
|
||||
- [SetDataOptions](interfaces/SetDataOptions.md)
|
||||
- [TimeoutManager](interfaces/TimeoutManager.md)
|
||||
|
||||
## Type Aliases
|
||||
|
||||
- [AnyDataTag](type-aliases/AnyDataTag.md)
|
||||
- [CreateBaseMutationResult](type-aliases/CreateBaseMutationResult.md)
|
||||
- [CreateBaseQueryResult](type-aliases/CreateBaseQueryResult.md)
|
||||
- [CreateInfiniteQueryResult](type-aliases/CreateInfiniteQueryResult.md)
|
||||
- [CreateMutateAsyncFunction](type-aliases/CreateMutateAsyncFunction.md)
|
||||
- [CreateMutateFunction](type-aliases/CreateMutateFunction.md)
|
||||
- [CreateMutationResult](type-aliases/CreateMutationResult.md)
|
||||
- [CreateQueryResult](type-aliases/CreateQueryResult.md)
|
||||
- [DataTag](type-aliases/DataTag.md)
|
||||
- [dataTagErrorSymbol](type-aliases/dataTagErrorSymbol.md)
|
||||
- [dataTagSymbol](type-aliases/dataTagSymbol.md)
|
||||
- [DefaultedInfiniteQueryObserverOptions](type-aliases/DefaultedInfiniteQueryObserverOptions.md)
|
||||
- [DefaultedQueryObserverOptions](type-aliases/DefaultedQueryObserverOptions.md)
|
||||
- [DefaultError](type-aliases/DefaultError.md)
|
||||
- [DefinedCreateInfiniteQueryResult](type-aliases/DefinedCreateInfiniteQueryResult.md)
|
||||
- [DefinedCreateQueryResult](type-aliases/DefinedCreateQueryResult.md)
|
||||
- [DefinedInfiniteQueryObserverResult](type-aliases/DefinedInfiniteQueryObserverResult.md)
|
||||
- [DefinedInitialDataInfiniteOptions](type-aliases/DefinedInitialDataInfiniteOptions.md)
|
||||
- [DefinedInitialDataOptions](type-aliases/DefinedInitialDataOptions.md)
|
||||
- [DefinedQueryObserverResult](type-aliases/DefinedQueryObserverResult.md)
|
||||
- [DevtoolsFeature](type-aliases/DevtoolsFeature.md)
|
||||
- [DistributiveOmit](type-aliases/DistributiveOmit.md)
|
||||
- [~~EnsureInfiniteQueryDataOptions~~](type-aliases/EnsureInfiniteQueryDataOptions.md)
|
||||
- [~~FetchInfiniteQueryOptions~~](type-aliases/FetchInfiniteQueryOptions.md)
|
||||
- [FetchStatus](type-aliases/FetchStatus.md)
|
||||
- [GetNextPageParamFunction](type-aliases/GetNextPageParamFunction.md)
|
||||
- [GetPreviousPageParamFunction](type-aliases/GetPreviousPageParamFunction.md)
|
||||
- [InferDataFromTag](type-aliases/InferDataFromTag.md)
|
||||
- [InferErrorFromTag](type-aliases/InferErrorFromTag.md)
|
||||
- [InfiniteQueryExecuteOptions](type-aliases/InfiniteQueryExecuteOptions.md)
|
||||
- [InfiniteQueryObserverResult](type-aliases/InfiniteQueryObserverResult.md)
|
||||
- [InitialDataFunction](type-aliases/InitialDataFunction.md)
|
||||
- [ManagedTimerId](type-aliases/ManagedTimerId.md)
|
||||
- [MutateFunction](type-aliases/MutateFunction.md)
|
||||
- [MutateFunctionRest](type-aliases/MutateFunctionRest.md)
|
||||
- [MutationCacheNotifyEvent](type-aliases/MutationCacheNotifyEvent.md)
|
||||
- [MutationFunction](type-aliases/MutationFunction.md)
|
||||
- [MutationFunctionContext](type-aliases/MutationFunctionContext.md)
|
||||
- [MutationKey](type-aliases/MutationKey.md)
|
||||
- [MutationMeta](type-aliases/MutationMeta.md)
|
||||
- [MutationObserverResult](type-aliases/MutationObserverResult.md)
|
||||
- [MutationScope](type-aliases/MutationScope.md)
|
||||
- [MutationStatus](type-aliases/MutationStatus.md)
|
||||
- [NetworkMode](type-aliases/NetworkMode.md)
|
||||
- [NonUndefinedGuard](type-aliases/NonUndefinedGuard.md)
|
||||
- [NotifyEventType](type-aliases/NotifyEventType.md)
|
||||
- [NotifyOnChangeProps](type-aliases/NotifyOnChangeProps.md)
|
||||
- [OmitKeyof](type-aliases/OmitKeyof.md)
|
||||
- [Override](type-aliases/Override.md)
|
||||
- [PersistQueryClientFeature](type-aliases/PersistQueryClientFeature.md)
|
||||
- [PlaceholderDataFunction](type-aliases/PlaceholderDataFunction.md)
|
||||
- [QueriesOptions](type-aliases/QueriesOptions.md)
|
||||
- [QueriesPlaceholderDataFunction](type-aliases/QueriesPlaceholderDataFunction.md)
|
||||
- [QueriesResults](type-aliases/QueriesResults.md)
|
||||
- [QueryBooleanOption](type-aliases/QueryBooleanOption.md)
|
||||
- [QueryCacheNotifyEvent](type-aliases/QueryCacheNotifyEvent.md)
|
||||
- [QueryFeatures](type-aliases/QueryFeatures.md)
|
||||
- [QueryFunction](type-aliases/QueryFunction.md)
|
||||
- [QueryFunctionContext](type-aliases/QueryFunctionContext.md)
|
||||
- [QueryKey](type-aliases/QueryKey.md)
|
||||
- [QueryKeyHashFunction](type-aliases/QueryKeyHashFunction.md)
|
||||
- [QueryKeyWithDataTag](type-aliases/QueryKeyWithDataTag.md)
|
||||
- [QueryMeta](type-aliases/QueryMeta.md)
|
||||
- [QueryObserverResult](type-aliases/QueryObserverResult.md)
|
||||
- [QueryPersister](type-aliases/QueryPersister.md)
|
||||
- [QueryStatus](type-aliases/QueryStatus.md)
|
||||
- [SkipToken](type-aliases/SkipToken.md)
|
||||
- [StaleTime](type-aliases/StaleTime.md)
|
||||
- [StaleTimeFunction](type-aliases/StaleTimeFunction.md)
|
||||
- [ThrowOnError](type-aliases/ThrowOnError.md)
|
||||
- [TimeoutCallback](type-aliases/TimeoutCallback.md)
|
||||
- [TimeoutProvider](type-aliases/TimeoutProvider.md)
|
||||
- [UndefinedInitialDataInfiniteOptions](type-aliases/UndefinedInitialDataInfiniteOptions.md)
|
||||
- [UndefinedInitialDataOptions](type-aliases/UndefinedInitialDataOptions.md)
|
||||
- [UnsetMarker](type-aliases/UnsetMarker.md)
|
||||
- [UnusedSkipTokenInfiniteOptions](type-aliases/UnusedSkipTokenInfiniteOptions.md)
|
||||
- [UnusedSkipTokenOptions](type-aliases/UnusedSkipTokenOptions.md)
|
||||
- [Updater](type-aliases/Updater.md)
|
||||
- [WithRequired](type-aliases/WithRequired.md)
|
||||
|
||||
## Variables
|
||||
|
||||
- [dataTagErrorSymbol](variables/dataTagErrorSymbol.md)
|
||||
- [dataTagSymbol](variables/dataTagSymbol.md)
|
||||
- [defaultScheduler](variables/defaultScheduler.md)
|
||||
- [environmentManager](variables/environmentManager.md)
|
||||
- [focusManager](variables/focusManager.md)
|
||||
- [~~isServer~~](variables/isServer.md)
|
||||
- [notifyManager](variables/notifyManager.md)
|
||||
- [onlineManager](variables/onlineManager.md)
|
||||
- [skipToken](variables/skipToken.md)
|
||||
- [timeoutManager](variables/timeoutManager.md)
|
||||
- [unsetMarker](variables/unsetMarker.md)
|
||||
|
||||
## Functions
|
||||
|
||||
- [defaultShouldDehydrateMutation](functions/defaultShouldDehydrateMutation.md)
|
||||
- [defaultShouldDehydrateQuery](functions/defaultShouldDehydrateQuery.md)
|
||||
- [dehydrate](functions/dehydrate.md)
|
||||
- [dehydrateQuery](functions/dehydrateQuery.md)
|
||||
- [experimental\_streamedQuery](functions/experimental_streamedQuery.md)
|
||||
- [hashKey](functions/hashKey.md)
|
||||
- [hydrate](functions/hydrate.md)
|
||||
- [infiniteQueryOptions](functions/infiniteQueryOptions.md)
|
||||
- [injectInfiniteQuery](functions/injectInfiniteQuery.md)
|
||||
- [injectIsFetching](functions/injectIsFetching.md)
|
||||
- [injectIsMutating](functions/injectIsMutating.md)
|
||||
- [injectIsRestoring](functions/injectIsRestoring.md)
|
||||
- [injectMutation](functions/injectMutation.md)
|
||||
- [injectMutationState](functions/injectMutationState.md)
|
||||
- [injectQuery](functions/injectQuery.md)
|
||||
- [~~injectQueryClient~~](functions/injectQueryClient.md)
|
||||
- [~~isCancelledError~~](functions/isCancelledError.md)
|
||||
- [keepPreviousData](functions/keepPreviousData.md)
|
||||
- [matchMutation](functions/matchMutation.md)
|
||||
- [matchQuery](functions/matchQuery.md)
|
||||
- [mutationOptions](functions/mutationOptions.md)
|
||||
- [noop](functions/noop.md)
|
||||
- [partialMatchKey](functions/partialMatchKey.md)
|
||||
- [~~provideAngularQuery~~](functions/provideAngularQuery.md)
|
||||
- [provideIsRestoring](functions/provideIsRestoring.md)
|
||||
- [provideQueryClient](functions/provideQueryClient.md)
|
||||
- [provideTanStackQuery](functions/provideTanStackQuery.md)
|
||||
- [queryFeature](functions/queryFeature.md)
|
||||
- [queryOptions](functions/queryOptions.md)
|
||||
- [replaceEqualDeep](functions/replaceEqualDeep.md)
|
||||
- [shouldThrowError](functions/shouldThrowError.md)
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
id: BaseMutationNarrowing
|
||||
title: BaseMutationNarrowing
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:328](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L328)
|
||||
|
||||
The `isSuccess`/`isError`/`isPending`/`isIdle` methods on a mutation result. Each is both a `Signal`
|
||||
(its current boolean value is read reactively without calling it) and a type-guard function you can
|
||||
call — `if (mutation.isSuccess())` — so that `mutation.data` narrows away `undefined` inside the branch.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
The type your mutation function resolves to.
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
The type of errors your mutation function may throw.
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `unknown`
|
||||
|
||||
The type of the variable passed to `mutate`/`mutateAsync`.
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
|
||||
their `onMutateResult` parameter — useful for optimistic-update rollback data.
|
||||
|
||||
## Properties
|
||||
|
||||
### isError
|
||||
|
||||
```ts
|
||||
isError: SignalFunction<(this) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, Override<MutationObserverErrorResult<TData, TError, TVariables, TOnMutateResult>, { mutate: CreateMutateFunction<TData, TError, TVariables, TOnMutateResult> }> & { mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult> }>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:351](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L351)
|
||||
|
||||
***
|
||||
|
||||
### isIdle
|
||||
|
||||
```ts
|
||||
isIdle: SignalFunction<(this) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, Override<MutationObserverIdleResult<TData, TError, TVariables, TOnMutateResult>, { mutate: CreateMutateFunction<TData, TError, TVariables, TOnMutateResult> }> & { mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult> }>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:385](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L385)
|
||||
|
||||
***
|
||||
|
||||
### isPending
|
||||
|
||||
```ts
|
||||
isPending: SignalFunction<(this) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, Override<MutationObserverLoadingResult<TData, TError, TVariables, TOnMutateResult>, { mutate: CreateMutateFunction<TData, TError, TVariables, TOnMutateResult> }> & { mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult> }>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:368](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L368)
|
||||
|
||||
***
|
||||
|
||||
### isSuccess
|
||||
|
||||
```ts
|
||||
isSuccess: SignalFunction<(this) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, Override<MutationObserverSuccessResult<TData, TError, TVariables, TOnMutateResult>, { mutate: CreateMutateFunction<TData, TError, TVariables, TOnMutateResult> }> & { mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult> }>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:334](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L334)
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
id: BaseQueryNarrowing
|
||||
title: BaseQueryNarrowing
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L83)
|
||||
|
||||
The `isSuccess`/`isError`/`isPending` methods on a query result. Unlike `react-query`'s derived booleans,
|
||||
these are type-guard methods you call — `if (query.isSuccess())` — so that `query.data` narrows away
|
||||
`undefined` inside the branch, the same way `status` narrowing works on the plain object `react-query`
|
||||
returns.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
The type `data` ends up as after `select` runs.
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
The type of errors your `queryFn` may throw.
|
||||
|
||||
## Properties
|
||||
|
||||
### isError()
|
||||
|
||||
```ts
|
||||
isError: (this) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"error", TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:91](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L91)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### this
|
||||
|
||||
[`CreateBaseQueryResult`](../type-aliases/CreateBaseQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"error", TData, TError>>`
|
||||
|
||||
***
|
||||
|
||||
### isPending()
|
||||
|
||||
```ts
|
||||
isPending: (this) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"pending", TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:98](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L98)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### this
|
||||
|
||||
[`CreateBaseQueryResult`](../type-aliases/CreateBaseQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"pending", TData, TError>>`
|
||||
|
||||
***
|
||||
|
||||
### isSuccess()
|
||||
|
||||
```ts
|
||||
isSuccess: (this) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"success", TData, TError>>;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:84](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L84)
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### this
|
||||
|
||||
[`CreateBaseQueryResult`](../type-aliases/CreateBaseQueryResult.md)\<`TData`, `TError`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<"success", TData, TError>>`
|
||||
26
docs/framework/angular/reference/interfaces/CancelOptions.md
Normal file
26
docs/framework/angular/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)
|
||||
@@ -0,0 +1,636 @@
|
||||
---
|
||||
id: CreateBaseQueryOptions
|
||||
title: CreateBaseQueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:34](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L34)
|
||||
|
||||
The options shared across `angular-query-experimental`'s query functions. Extends
|
||||
[QueryObserverOptions](QueryObserverOptions.md) from `@tanstack/query-core` as-is — unlike `react-query`,
|
||||
`angular-query-experimental` has no extra framework-specific option here.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`QueryObserverOptions`](QueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryData`, `TQueryKey`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
The type your `queryFn` resolves to.
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
The type of errors your `queryFn` may throw.
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no
|
||||
`select` is used.
|
||||
|
||||
### TQueryData
|
||||
|
||||
`TQueryData` = `TQueryFnData`
|
||||
|
||||
The type of the data actually held in the query cache — the input to `select` and
|
||||
`placeholderData`. Defaults to, and is usually the same as, `TQueryFnData`.
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
The type of your `queryKey`.
|
||||
|
||||
## 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`.
|
||||
|
||||
#### 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)
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
[`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)
|
||||
|
||||
***
|
||||
|
||||
### 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: (queryFn, context, query) => TQueryFnData | Promise<TQueryFnData>;
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### queryFn
|
||||
|
||||
[`QueryFunction`](../type-aliases/QueryFunction.md)\<`TQueryFnData`, `NoInfer`\<`TQueryKey`\>, `never`\>
|
||||
|
||||
##### context
|
||||
|
||||
###### client
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md)
|
||||
|
||||
###### direction?
|
||||
|
||||
`unknown`
|
||||
|
||||
**Deprecated**
|
||||
|
||||
if you want access to the direction, you can add it to the pageParam
|
||||
|
||||
###### meta
|
||||
|
||||
`Record`\<`string`, `unknown`\> \| `undefined`
|
||||
|
||||
###### pageParam?
|
||||
|
||||
`unknown`
|
||||
|
||||
###### queryKey
|
||||
|
||||
`NoInfer`\<`TQueryKey`\>
|
||||
|
||||
###### signal
|
||||
|
||||
`AbortSignal`
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`TQueryFnData` \| `Promise`\<`TQueryFnData`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`persister`](QueryObserverOptions.md#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.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`placeholderData`](QueryObserverOptions.md#placeholderdata)
|
||||
|
||||
***
|
||||
|
||||
### queryFn?
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, never>;
|
||||
```
|
||||
|
||||
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, 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`.
|
||||
|
||||
#### 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
|
||||
|
||||
`TQueryData`
|
||||
|
||||
#### Returns
|
||||
|
||||
`TData`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`select`](QueryObserverOptions.md#select)
|
||||
|
||||
***
|
||||
|
||||
### 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`.
|
||||
|
||||
#### 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, 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`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
[`QueryObserverOptions`](QueryObserverOptions.md).[`throwOnError`](QueryObserverOptions.md#throwonerror)
|
||||
@@ -0,0 +1,666 @@
|
||||
---
|
||||
id: CreateInfiniteQueryOptions
|
||||
title: CreateInfiniteQueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:121](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L121)
|
||||
|
||||
The options accepted by `injectInfiniteQuery`. Same as [CreateBaseQueryOptions](CreateBaseQueryOptions.md), minus `suspense` —
|
||||
which `angular-query-experimental` doesn't support, unlike `react-query` — extends
|
||||
[InfiniteQueryObserverOptions](InfiniteQueryObserverOptions.md) from `@tanstack/query-core` for the infinite-query-specific options
|
||||
(`getNextPageParam`, `initialPageParam`, etc.).
|
||||
|
||||
## Extends
|
||||
|
||||
- [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`InfiniteQueryObserverOptions`](InfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\>, `"suspense"`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
The type of a single page, as your `queryFn` resolves it.
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
The type of errors your `queryFn` may throw.
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` here, though
|
||||
`injectInfiniteQuery` itself defaults it to `InfiniteData<TQueryFnData>` — the shape `data` actually has
|
||||
when no `select` is used.
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
The type of your `queryKey`.
|
||||
|
||||
### TPageParam
|
||||
|
||||
`TPageParam` = `unknown`
|
||||
|
||||
The type of the parameter passed to `queryFn` to fetch a given page.
|
||||
|
||||
## 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`gcTime`](QueryOptions.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`maxPages`](QueryOptions.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`meta`](QueryOptions.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`networkMode`](QueryOptions.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`queryHash`](QueryOptions.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.structuralSharing
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.throwOnError
|
||||
```
|
||||
@@ -0,0 +1,354 @@
|
||||
---
|
||||
id: CreateMutationOptions
|
||||
title: CreateMutationOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:224](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L224)
|
||||
|
||||
The options accepted by `injectMutation`. Same as [MutationObserverOptions](MutationObserverOptions.md) from
|
||||
`@tanstack/query-core`, minus the internal `_defaulted` flag.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`MutationObserverOptions`](MutationObserverOptions.md)\<`TData`, `TError`, `TVariables`, `TOnMutateResult`\>, `"_defaulted"`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `unknown`
|
||||
|
||||
The type your mutation function resolves to.
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
The type of errors your mutation function may throw.
|
||||
|
||||
### TVariables
|
||||
|
||||
`TVariables` = `void`
|
||||
|
||||
The type of the variable passed to `mutate`/`mutateAsync`.
|
||||
|
||||
### TOnMutateResult
|
||||
|
||||
`TOnMutateResult` = `unknown`
|
||||
|
||||
The type returned by `onMutate`, passed to `onSuccess`/`onError`/`onSettled` as
|
||||
their `onMutateResult` parameter — useful for optimistic-update rollback data.
|
||||
|
||||
## 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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`.
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
OmitKeyof.throwOnError
|
||||
```
|
||||
@@ -0,0 +1,647 @@
|
||||
---
|
||||
id: CreateQueryOptions
|
||||
title: CreateQueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/types.ts:58](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L58)
|
||||
|
||||
The options accepted by `injectQuery`. Same as [CreateBaseQueryOptions](CreateBaseQueryOptions.md), minus `suspense` — which
|
||||
`angular-query-experimental` doesn't support, unlike `react-query`.
|
||||
|
||||
## Extends
|
||||
|
||||
- [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`CreateBaseQueryOptions`](CreateBaseQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryFnData`, `TQueryKey`\>, `"suspense"`\>
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TQueryFnData
|
||||
|
||||
`TQueryFnData` = `unknown`
|
||||
|
||||
The type your `queryFn` resolves to.
|
||||
|
||||
### TError
|
||||
|
||||
`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
|
||||
|
||||
The type of errors your `queryFn` may throw.
|
||||
|
||||
### TData
|
||||
|
||||
`TData` = `TQueryFnData`
|
||||
|
||||
The type `data` ends up as after `select` runs. Defaults to `TQueryFnData` when no
|
||||
`select` is used.
|
||||
|
||||
### TQueryKey
|
||||
|
||||
`TQueryKey` *extends* [`QueryKey`](../type-aliases/QueryKey.md) = [`QueryKey`](../type-aliases/QueryKey.md)
|
||||
|
||||
The type of your `queryKey`.
|
||||
|
||||
## Properties
|
||||
|
||||
### enabled?
|
||||
|
||||
```ts
|
||||
optional enabled: QueryBooleanOption<TQueryFnData, TError, TQueryFnData, 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`gcTime`](QueryOptions.md#gctime)
|
||||
|
||||
***
|
||||
|
||||
### initialData?
|
||||
|
||||
```ts
|
||||
optional initialData:
|
||||
| TQueryFnData
|
||||
| InitialDataFunction<TQueryFnData>;
|
||||
```
|
||||
|
||||
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
|
||||
OmitKeyof.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
|
||||
OmitKeyof.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`maxPages`](QueryOptions.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`meta`](QueryOptions.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`networkMode`](QueryOptions.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: (queryFn, context, query) => TQueryFnData | Promise<TQueryFnData>;
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
#### Parameters
|
||||
|
||||
##### queryFn
|
||||
|
||||
[`QueryFunction`](../type-aliases/QueryFunction.md)\<`TQueryFnData`, `NoInfer`\<`TQueryKey`\>, `never`\>
|
||||
|
||||
##### context
|
||||
|
||||
###### client
|
||||
|
||||
[`QueryClient`](../classes/QueryClient.md)
|
||||
|
||||
###### direction?
|
||||
|
||||
`unknown`
|
||||
|
||||
**Deprecated**
|
||||
|
||||
if you want access to the direction, you can add it to the pageParam
|
||||
|
||||
###### meta
|
||||
|
||||
`Record`\<`string`, `unknown`\> \| `undefined`
|
||||
|
||||
###### pageParam?
|
||||
|
||||
`unknown`
|
||||
|
||||
###### queryKey
|
||||
|
||||
`NoInfer`\<`TQueryKey`\>
|
||||
|
||||
###### signal
|
||||
|
||||
`AbortSignal`
|
||||
|
||||
##### query
|
||||
|
||||
[`Query`](../classes/Query.md)
|
||||
|
||||
#### Returns
|
||||
|
||||
`TQueryFnData` \| `Promise`\<`TQueryFnData`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
OmitKeyof.persister
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### placeholderData?
|
||||
|
||||
```ts
|
||||
optional placeholderData:
|
||||
| NonFunctionGuard<TQueryFnData>
|
||||
| PlaceholderDataFunction<NonFunctionGuard<TQueryFnData>, TError, NonFunctionGuard<TQueryFnData>, 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.placeholderData
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### queryFn?
|
||||
|
||||
```ts
|
||||
optional queryFn:
|
||||
| typeof skipToken
|
||||
| QueryFunction<TQueryFnData, TQueryKey, never>;
|
||||
```
|
||||
|
||||
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
|
||||
OmitKeyof.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
|
||||
|
||||
[`QueryOptions`](QueryOptions.md).[`queryHash`](QueryOptions.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
OmitKeyof.retryDelay
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### retryOnMount?
|
||||
|
||||
```ts
|
||||
optional retryOnMount: QueryBooleanOption<TQueryFnData, TError, TQueryFnData, 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
`TQueryFnData`
|
||||
|
||||
#### Returns
|
||||
|
||||
`TData`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
```ts
|
||||
OmitKeyof.select
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### staleTime?
|
||||
|
||||
```ts
|
||||
optional staleTime: StaleTimeFunction<TQueryFnData, TError, TQueryFnData, 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.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
|
||||
|
||||
```ts
|
||||
OmitKeyof.structuralSharing
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### throwOnError?
|
||||
|
||||
```ts
|
||||
optional throwOnError: ThrowOnError<TQueryFnData, TError, TQueryFnData, 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
|
||||
|
||||
```ts
|
||||
OmitKeyof.throwOnError
|
||||
```
|
||||
@@ -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.
|
||||
@@ -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`
|
||||
@@ -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/angular/reference/interfaces/FetchQueryOptions.md
Normal file
364
docs/framework/angular/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/angular/reference/interfaces/FocusManager.md
Normal file
237
docs/framework/angular/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
|
||||
```
|
||||
@@ -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/angular/reference/interfaces/InfiniteData.md
Normal file
36
docs/framework/angular/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)
|
||||
@@ -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)
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
id: InjectInfiniteQueryOptions
|
||||
title: InjectInfiniteQueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-infinite-query.ts:25](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-infinite-query.ts#L25)
|
||||
|
||||
## Properties
|
||||
|
||||
### injector?
|
||||
|
||||
```ts
|
||||
optional injector: Injector;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-infinite-query.ts:31](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-infinite-query.ts#L31)
|
||||
|
||||
The `Injector` in which to create the infinite query.
|
||||
|
||||
If this is not provided, the current injection context will be used instead (via `inject`).
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
id: InjectIsFetchingOptions
|
||||
title: InjectIsFetchingOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-fetching.ts:13](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-fetching.ts#L13)
|
||||
|
||||
## Properties
|
||||
|
||||
### injector?
|
||||
|
||||
```ts
|
||||
optional injector: Injector;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-fetching.ts:19](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-fetching.ts#L19)
|
||||
|
||||
The `Injector` in which to create the isFetching signal.
|
||||
|
||||
If this is not provided, the current injection context will be used instead (via `inject`).
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
id: InjectIsMutatingOptions
|
||||
title: InjectIsMutatingOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-mutating.ts:13](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-mutating.ts#L13)
|
||||
|
||||
## Properties
|
||||
|
||||
### injector?
|
||||
|
||||
```ts
|
||||
optional injector: Injector;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-is-mutating.ts:19](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-mutating.ts#L19)
|
||||
|
||||
The `Injector` in which to create the isMutating signal.
|
||||
|
||||
If this is not provided, the current injection context will be used instead (via `inject`).
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
id: InjectMutationOptions
|
||||
title: InjectMutationOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-mutation.ts:28](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-mutation.ts#L28)
|
||||
|
||||
## Properties
|
||||
|
||||
### injector?
|
||||
|
||||
```ts
|
||||
optional injector: Injector;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-mutation.ts:34](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-mutation.ts#L34)
|
||||
|
||||
The `Injector` in which to create the mutation.
|
||||
|
||||
If this is not provided, the current injection context will be used instead (via `inject`).
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
id: InjectMutationStateOptions
|
||||
title: InjectMutationStateOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-mutation-state.ts:40](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-mutation-state.ts#L40)
|
||||
|
||||
## Properties
|
||||
|
||||
### injector?
|
||||
|
||||
```ts
|
||||
optional injector: Injector;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-mutation-state.ts:46](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-mutation-state.ts#L46)
|
||||
|
||||
The `Injector` in which to create the mutation state signal.
|
||||
|
||||
If this is not provided, the current injection context will be used instead (via `inject`).
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
id: InjectQueryOptions
|
||||
title: InjectQueryOptions
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-query.ts:20](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query.ts#L20)
|
||||
|
||||
## Properties
|
||||
|
||||
### injector?
|
||||
|
||||
```ts
|
||||
optional injector: Injector;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/inject-query.ts:26](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query.ts#L26)
|
||||
|
||||
The `Injector` in which to create the query.
|
||||
|
||||
If this is not provided, the current injection context will be used instead (via `inject`).
|
||||
@@ -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/angular/reference/interfaces/MutateOptions.md
Normal file
124
docs/framework/angular/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`
|
||||
@@ -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`
|
||||
@@ -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/angular/reference/interfaces/MutationOptions.md
Normal file
257
docs/framework/angular/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/angular/reference/interfaces/MutationState.md
Normal file
142
docs/framework/angular/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/angular/reference/interfaces/NotifyEvent.md
Normal file
16
docs/framework/angular/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/angular/reference/interfaces/OnlineManager.md
Normal file
214
docs/framework/angular/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.
|
||||
@@ -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`
|
||||
@@ -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.
|
||||
@@ -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
|
||||
```
|
||||
34
docs/framework/angular/reference/interfaces/QueryFeature.md
Normal file
34
docs/framework/angular/reference/interfaces/QueryFeature.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
id: QueryFeature
|
||||
title: QueryFeature
|
||||
---
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:132](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L132)
|
||||
|
||||
Helper type to represent a Query feature.
|
||||
|
||||
## Type Parameters
|
||||
|
||||
### TFeatureKind
|
||||
|
||||
`TFeatureKind` *extends* `QueryFeatureKind`
|
||||
|
||||
## Properties
|
||||
|
||||
### ɵkind
|
||||
|
||||
```ts
|
||||
ɵkind: TFeatureKind;
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:133](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L133)
|
||||
|
||||
***
|
||||
|
||||
### ɵproviders
|
||||
|
||||
```ts
|
||||
ɵproviders: Provider[];
|
||||
```
|
||||
|
||||
Defined in: [packages/angular-query-experimental/src/providers.ts:134](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/providers.ts#L134)
|
||||
104
docs/framework/angular/reference/interfaces/QueryFilters.md
Normal file
104
docs/framework/angular/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)
|
||||
@@ -0,0 +1,561 @@
|
||||
---
|
||||
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)
|
||||
- [`CreateBaseQueryOptions`](CreateBaseQueryOptions.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`.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user