API Documentation / @pinia/colada / UseQueryEntry
Interface: UseQueryEntry<TData, TError, TDataInitial> 
A query entry in the cache.
Type Parameters 
TData 
TData = unknown
TError 
TError = unknown
TDataInitial 
TDataInitial extends TData | undefined = unknown extends TData ? unknown : undefined
Properties 
active 
readonly active: boolean;Whether the query is currently being used by a Component or EffectScope (e.g. a store).
asyncStatus 
asyncStatus: ShallowRef<AsyncStatus>;The status of the query.
deps 
deps: Set<EffectScope | ComponentInternalInstance>;Components and effects scopes that use this query entry.
ext 
ext: UseQueryEntryExtensions<TData, TError, TDataInitial>;Extensions to the query entry added by plugins.
gcTimeout 
gcTimeout: undefined | Timeout;Timeout id that scheduled a garbage collection. It is set here to clear it when the entry is used by a different component
key 
key: EntryKey;The serialized key associated with this query entry.
keyHash 
keyHash: string;Seriaized version of the key. Used to retrieve the entry from the cache.
options 
options: 
  | null
| UseQueryOptionsWithDefaults<TData, TError, TDataInitial>;Options used to create the query. They can be null during hydration but are needed for fetching. This is why store.ensure() sets this property. Note these options might be shared by multiple query entries when the key is dynamic and that's why some methods like fetch receive the options as an argument.
pending 
pending: 
  | null
  | {
  abortController: AbortController;
  refreshCall: Promise<DataState<TData, TError, TDataInitial>>;
  when: number;
};The current pending request.
Type declaration 
null
{
  abortController: AbortController;
  refreshCall: Promise<DataState<TData, TError, TDataInitial>>;
  when: number;
}abortController 
abortController: AbortController;The abort controller used to cancel the request and which signal is passed to the query function.
refreshCall 
refreshCall: Promise<DataState<TData, TError, TDataInitial>>;The promise created by queryCache.fetch that is currently pending.
when 
when: number;When was this pending object created.
placeholderData 
placeholderData: undefined | null | TData | TDataInitial;A placeholder data that is initially shown while the query is loading for the first time. This will also show the status as success until the query finishes loading (no matter the outcome).
stale 
readonly stale: boolean;Whether the data is stale or not, requires options.staleTime to be set.
state 
state: ShallowRef<DataState<TData, TError, TDataInitial>>;The state of the query. Contains the data, error and status.
when 
when: number;When was this data set in the entry for the last time in ms. It can also be 0 if the entry has been invalidated.