Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

QueryObserverLoadingResult.md

55 lines6.0 KB

1---
2id: QueryObserverLoadingResult
3title: QueryObserverLoadingResult
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8Defined in: [packages/query-core/src/types.ts:1138](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1138)
9​
10A query result in the `pending` state while the first fetch is in flight, so `isLoading` is
11`true`.
12​
13## Extends
14​
15- [`QueryObserverBaseResult`](QueryObserverBaseResult.md)\<`TData`, `TError`\>
16​
17## Type Parameters
18​
19### TData
20​
21`TData` = `unknown`
22​
23### TError
24​
25`TError` = [`DefaultError`](../type-aliases/DefaultError.md)
26​
27## Properties
28​
29| Property | Type | Description | Overrides |
30| ------ | ------ | ------ | ------ |
31| <a id="property-data"></a> `data` | `undefined` | `undefined`, since the query has no data yet. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`data`](QueryObserverBaseResult.md#property-data) |
32| <a id="property-dataupdatedat"></a> `dataUpdatedAt` | `number` | The timestamp for when the query most recently returned the `status` as `"success"`. | - |
33| <a id="property-error"></a> `error` | `null` | `null`, since the query isn't in the `error` state. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`error`](QueryObserverBaseResult.md#property-error) |
34| <a id="property-errorupdatecount"></a> `errorUpdateCount` | `number` | The sum of all errors. | - |
35| <a id="property-errorupdatedat"></a> `errorUpdatedAt` | `number` | The timestamp for when the query most recently returned the `status` as `"error"`. | - |
36| <a id="property-failurecount"></a> `failureCount` | `number` | The failure count for the query. - Incremented every time the query fails. - Reset to `0` when the query succeeds. | - |
37| <a id="property-failurereason"></a> `failureReason` | `TError` \| `null` | The failure reason for the query retry. - Reset to `null` when the query succeeds. | - |
38| <a id="property-fetchstatus"></a> `fetchStatus` | `"fetching"` \| `"paused"` \| `"idle"` | 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. | - |
39| <a id="property-isenabled"></a> `isEnabled` | `boolean` | `true` if this observer is enabled, `false` otherwise. | - |
40| <a id="property-iserror"></a> `isError` | `false` | `false`, since the query isn't in the `error` state. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isError`](QueryObserverBaseResult.md#property-iserror) |
41| <a id="property-isfetched"></a> `isFetched` | `boolean` | Will be `true` if the query has been fetched. | - |
42| <a id="property-isfetchedaftermount"></a> `isFetchedAfterMount` | `boolean` | 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. | - |
43| <a id="property-isfetching"></a> `isFetching` | `boolean` | 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. | - |
44| <a id="property-isinitialloading"></a> ~~`isInitialLoading`~~ | `boolean` | **Deprecated** `isInitialLoading` is being deprecated in favor of `isLoading` and will be removed in the next major version. | - |
45| <a id="property-isloading"></a> `isLoading` | `true` | `true`, since the first fetch is in flight. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoading`](QueryObserverBaseResult.md#property-isloading) |
46| <a id="property-isloadingerror"></a> `isLoadingError` | `false` | `false`, since the query didn't fail while fetching for the first time. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isLoadingError`](QueryObserverBaseResult.md#property-isloadingerror) |
47| <a id="property-ispaused"></a> `isPaused` | `boolean` | A derived boolean from the `fetchStatus` variable, provided for convenience. - The query wanted to fetch, but has been `paused`. | - |
48| <a id="property-ispending"></a> `isPending` | `true` | `true`, since there's no cached data and no query attempt has finished yet. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPending`](QueryObserverBaseResult.md#property-ispending) |
49| <a id="property-isplaceholderdata"></a> `isPlaceholderData` | `false` | `false`, since the data shown isn't the `placeholderData`. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isPlaceholderData`](QueryObserverBaseResult.md#property-isplaceholderdata) |
50| <a id="property-isrefetcherror"></a> `isRefetchError` | `false` | `false`, since the query didn't fail while refetching. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isRefetchError`](QueryObserverBaseResult.md#property-isrefetcherror) |
51| <a id="property-isrefetching"></a> `isRefetching` | `boolean` | Is `true` whenever a background refetch is in-flight, which _does not_ include initial `pending`. - Is the same as `isFetching && !isPending`. | - |
52| <a id="property-isstale"></a> `isStale` | `boolean` | Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. | - |
53| <a id="property-issuccess"></a> `isSuccess` | `false` | `false`, since the query isn't in the `success` state. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`isSuccess`](QueryObserverBaseResult.md#property-issuccess) |
54| <a id="property-refetch"></a> `refetch` | (`options?`: [`RefetchOptions`](RefetchOptions.md)) => `Promise`\<[`QueryObserverResult`](../type-aliases/QueryObserverResult.md)\<`TData`, `TError`\>\> | A function to manually refetch the query. | - |
55| <a id="property-status"></a> `status` | `"pending"` | `'pending'`, since there's no cached data and no query attempt has finished yet. | [`QueryObserverBaseResult`](QueryObserverBaseResult.md).[`status`](QueryObserverBaseResult.md#property-status) |