API Documentation / @pinia/colada / UseQueryReturn
Interface: UseQueryReturn<TData, TError, TDataInitial> 
Return type of useQuery().
Extends 
UseQueryEntryExtensions<TData,TError,TDataInitial>
Type Parameters 
TData 
TData = unknown
TError 
TError = ErrorDefault
TDataInitial 
TDataInitial extends TData | undefined = undefined
Properties 
asyncStatus 
asyncStatus: ComputedRef<AsyncStatus>;Status of the query. Becomes 'loading' while the query is being fetched, is 'idle' otherwise.
data 
data: ShallowRef<TData | TDataInitial>;The last successful data resolved by the query. Alias for state.value.data.
See 
error 
error: ShallowRef<null | TError>;The error rejected by the query. Alias for state.value.error.
See 
isDelaying 
isDelaying: ShallowRef<boolean>;Returns whether the query is currently delaying its asyncStatus from becoming 'loading'. Requires the PiniaColadaDelay plugin.
Inherited from 
UseQueryEntryExtensions.isDelayingisLoading 
isLoading: ShallowRef<boolean>;Returns whether the request is currently fetching data. Alias for asyncStatus.value === 'loading'
isPending 
isPending: ComputedRef<boolean>;Returns whether the request is still pending its first call. Alias for status.value === 'pending'
isPlaceholderData 
isPlaceholderData: ComputedRef<boolean>;Returns whether the data is the placeholderData.
refetch() 
refetch: (throwOnError?) => Promise<DataState<TData, 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<TData, TError, TDataInitial>>
a promise that resolves when the fetch is done
refresh() 
refresh: (throwOnError?) => Promise<DataState<TData, 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<TData, TError, TDataInitial>>
a promise that resolves when the refresh is done
state 
state: ComputedRef<DataState<TData, TError, TDataInitial>>;The state of the query. Contains its data, error, and status.
status 
status: ShallowRef<DataStateStatus>;The status of the query. Alias for state.value.status.