Skip to content

API Documentation / @pinia/colada / UseInfiniteQueryReturn

Interface: UseInfiniteQueryReturn<TData, TError, TPageParam, TDataInitial> ​

Return type of useQuery().

Extends ​

Type Parameters ​

TData ​

TData = unknown

TError ​

TError = ErrorDefault

TPageParam ​

TPageParam = unknown

TDataInitial ​

TDataInitial extends | UseInfiniteQueryData<TData, TPageParam> | undefined = undefined

Properties ​

asyncStatus ​

ts
asyncStatus: ComputedRef<AsyncStatus>;

Status of the query. Becomes 'loading' while the query is being fetched, is 'idle' otherwise.

Inherited from ​

UseQueryReturn.asyncStatus


data ​

ts
data: ShallowRef<
  | TDataInitial
| UseInfiniteQueryData<TData, TPageParam>>;

The last successful data resolved by the query. Alias for state.value.data.

See ​

state

Inherited from ​

UseQueryReturn.data


dataUpdatedAt ​

ts
dataUpdatedAt: ShallowRef<number>;

Timestamp of when data was last successfully fetched. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.dataUpdatedAt


error ​

ts
error: ShallowRef<TError | null>;

The error rejected by the query. Alias for state.value.error.

See ​

state

Inherited from ​

UseQueryReturn.error


errorUpdatedAt ​

ts
errorUpdatedAt: ShallowRef<number>;

Timestamp of when an error last occurred. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.errorUpdatedAt


fetchStatus ​

ts
fetchStatus: ComputedRef<FetchStatus>;

TanStack Query compatible fetch status. Maps to: 'fetching' when loading, 'idle' otherwise. Note: 'paused' is not currently supported.

Inherited from ​

UseQueryReturn.fetchStatus


hasNextPage ​

ts
hasNextPage: ShallowRef<boolean>;

Whether there is a next page to load. Defined based on the result of UseInfiniteQueryOptions.getNextPageParam.


hasPreviousPage ​

ts
hasPreviousPage: ShallowRef<boolean>;

Whether there is a previous page to load. Defined based on the result of UseInfiniteQueryOptions.getPreviousPageParam.


isDelaying ​

ts
isDelaying: ShallowRef<boolean>;

Returns whether the query is currently delaying its asyncStatus from becoming 'loading'. Requires the PiniaColadaDelay plugin.

Inherited from ​

UseQueryReturn.isDelaying


isError ​

ts
isError: ComputedRef<boolean>;

Whether the query status is 'error'. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isError


isFetched ​

ts
isFetched: ShallowRef<boolean>;

Whether the query has fetched at least once. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isFetched


isFetchedAfterMount ​

ts
isFetchedAfterMount: ShallowRef<boolean>;

Whether the query has fetched after component mount. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isFetchedAfterMount


isFetching ​

ts
isFetching: ComputedRef<boolean>;

Whether the query is currently fetching (asyncStatus === 'loading'). TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isFetching


isLoading ​

ts
isLoading: ShallowRef<boolean>;

Returns whether the request is currently fetching data. Alias for asyncStatus.value === 'loading'

Inherited from ​

UseQueryReturn.isLoading


isLoadingError ​

ts
isLoadingError: ComputedRef<boolean>;

Whether the query errored on initial load (never had data). TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isLoadingError


isPending ​

ts
isPending: ComputedRef<boolean>;

Returns whether the request is still pending its first call. Alias for status.value === 'pending'

Inherited from ​

UseQueryReturn.isPending


isPlaceholderData ​

ts
isPlaceholderData: ComputedRef<boolean>;

Returns whether the data is the placeholderData.

Inherited from ​

UseQueryReturn.isPlaceholderData


isRefetchError ​

ts
isRefetchError: ComputedRef<boolean>;

Whether the query errored on refetch (had data before). TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isRefetchError


isRefetching ​

ts
isRefetching: ComputedRef<boolean>;

Whether the query is refetching (fetching but not initial load). TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isRefetching


isRetrying ​

ts
isRetrying: ShallowRef<boolean>;

Whether the query is currently retrying. Requires the @pinia/colada-plugin-retry plugin.

Inherited from ​

UseQueryReturn.isRetrying


isStale ​

ts
isStale: ComputedRef<boolean>;

Whether the query data is stale. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isStale


isSuccess ​

ts
isSuccess: ComputedRef<boolean>;

Whether the query status is 'success'. TanStack Query compatible property.

Inherited from ​

UseQueryReturn.isSuccess


loadNextPage ​

ts
loadNextPage: (options?) => Promise<unknown>;

Load the next page of data.

Parameters ​

options? ​

UseInfiniteQueryLoadMoreOptions

Returns ​

Promise<unknown>


loadPreviousPage ​

ts
loadPreviousPage: (options?) => Promise<unknown>;

Load the previous page of data. Requires UseInfiniteQueryOptions.getPreviousPageParam to be defined.

Parameters ​

options? ​

UseInfiniteQueryLoadMoreOptions

Returns ​

Promise<unknown>


refetch ​

ts
refetch: (throwOnError?) => Promise<DataState<UseInfiniteQueryData<TData, TPageParam>, TError, TDataInitial>>;

Ignores fresh data and triggers a new fetch

Parameters ​

throwOnError? ​

boolean

whether to throw an error if the fetch fails. Defaults to false

Returns ​

Promise<DataState<UseInfiniteQueryData<TData, TPageParam>, TError, TDataInitial>>

a promise that resolves when the fetch is done

Inherited from ​

UseQueryReturn.refetch


refresh ​

ts
refresh: (throwOnError?) => Promise<DataState<UseInfiniteQueryData<TData, TPageParam>, TError, TDataInitial>>;

Ensures the current data is fresh. If the data is stale, refetch, if not return as is.

Parameters ​

throwOnError? ​

boolean

whether to throw an error if the refresh fails. Defaults to false

Returns ​

Promise<DataState<UseInfiniteQueryData<TData, TPageParam>, TError, TDataInitial>>

a promise that resolves when the refresh is done

Inherited from ​

UseQueryReturn.refresh


retry? ​

ts
optional retry?: object;

Plain object with retry state for devtools. Only present in development mode.

isRetrying ​

ts
isRetrying: boolean;

retryCount ​

ts
retryCount: number;

retryError ​

ts
retryError: unknown;

Inherited from ​

UseQueryReturn.retry


retryCount ​

ts
retryCount: ShallowRef<number>;

The number of retries that have been scheduled so far. Resets on success or manual refetch. Requires the @pinia/colada-plugin-retry plugin.

Inherited from ​

UseQueryReturn.retryCount


retryError ​

ts
retryError: ShallowRef<TError | null>;

The error that triggered the current retry. null when not retrying or when retries are exhausted. Requires the @pinia/colada-plugin-retry plugin.

Inherited from ​

UseQueryReturn.retryError


state ​

ts
state: ComputedRef<DataState<UseInfiniteQueryData<TData, TPageParam>, TError, TDataInitial>>;

The state of the query. Contains its data, error, and status.

Inherited from ​

UseQueryReturn.state


status ​

ts
status: ShallowRef<DataStateStatus>;

The status of the query. Alias for state.value.status.

See ​

Inherited from ​

UseQueryReturn.status

Released under the MIT License.