API Documentation / @pinia/colada / UseInfiniteQueryReturn
Interface: UseInfiniteQueryReturn<TData, TError, TPageParam, TDataInitial>
Return type of useQuery().
Extends
UseQueryReturn<UseInfiniteQueryData<TData,TPageParam>,TError,TDataInitial>
Type Parameters
TData
TData = unknown
TError
TError = ErrorDefault
TPageParam
TPageParam = unknown
TDataInitial
TDataInitial extends | UseInfiniteQueryData<TData, TPageParam> | undefined = undefined
Properties
asyncStatus
asyncStatus: ComputedRef<AsyncStatus>;Status of the query. Becomes 'loading' while the query is being fetched, is 'idle' otherwise.
Inherited from
data
data: ShallowRef<
| TDataInitial
| UseInfiniteQueryData<TData, TPageParam>>;The last successful data resolved by the query. Alias for state.value.data.
See
Inherited from
error
error: ShallowRef<TError | null>;The error rejected by the query. Alias for state.value.error.
See
Inherited from
hasNextPage
hasNextPage: Ref<boolean>;Whether there is a next page to load. Defined based on the result of UseInfiniteQueryOptions.getNextPageParam.
hasPreviousPage
hasPreviousPage: Ref<boolean>;Whether there is a previous page to load. Defined based on the result of UseInfiniteQueryOptions.getPreviousPageParam.
isDelaying
isDelaying: ShallowRef<boolean>;Returns whether the query is currently delaying its asyncStatus from becoming 'loading'. Requires the PiniaColadaDelay plugin.
Inherited from
isLoading
isLoading: ShallowRef<boolean>;Returns whether the request is currently fetching data. Alias for asyncStatus.value === 'loading'
Inherited from
isPending
isPending: ComputedRef<boolean>;Returns whether the request is still pending its first call. Alias for status.value === 'pending'
Inherited from
isPlaceholderData
isPlaceholderData: ComputedRef<boolean>;Returns whether the data is the placeholderData.
Inherited from
UseQueryReturn.isPlaceholderData
loadNextPage()
loadNextPage: (options?) => Promise<unknown>;Load the next page of data.
Parameters
options?
UseInfiniteQueryLoadMoreOptions
Returns
Promise<unknown>
loadPreviousPage()
loadPreviousPage: (options?) => Promise<unknown>;Load the previous page of data. Requires UseInfiniteQueryOptions.getPreviousPageParam to be defined.
Parameters
options?
UseInfiniteQueryLoadMoreOptions
Returns
Promise<unknown>
refetch()
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
refresh()
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
state
state: ComputedRef<DataState<UseInfiniteQueryData<TData, TPageParam>, TError, TDataInitial>>;The state of the query. Contains its data, error, and status.
Inherited from
status
status: ShallowRef<DataStateStatus>;The status of the query. Alias for state.value.status.