tridion-sites-extensions-api-docs

Home > @tridion-sites/extensions > QueryResult

QueryResult interface

Signature:

export interface QueryResult<TData = unknown, TError = unknown>

Properties

Property Modifiers Type Description
data   TData | undefined The last successfully resolved data for the query.
dataUpdatedAt   number The timestamp for when the query most recently returned the status as success.
error   TError | null The error object for the query, if an error was thrown.
errorUpdateCount   number The sum of all errors.
errorUpdatedAt   number The timestamp for when the query most recently returned the status as error.
failureCount   number  
failureReason   TError | null The failure reason for the query retry. Reset to null when the query succeeds.
fetchStatus   QueryFetchStatus - fetching - Is true whenever the queryFn is executing, which includes initial loading as well as background refetches. - paused - The query wanted to fetch, but has been paused. - idle - The query is not fetching.
isError   boolean  
isFetched   boolean Will be true if the query has been fetched.
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.
isFetching   boolean  
isLoading   boolean  
isLoadingError   boolean  
isPaused   boolean  
isPending   boolean  
isPlaceholderData   boolean Will be true if the data shown is the placeholder data.
isRefetchError   boolean Will be true if the query failed while fetching for the first time.
isRefetching   boolean Is true whenever a background refetch is in-flight, which does not include initial loading.
isStale   boolean Will be true if the data in the cache is invalidated or if the data is older than the given staleTime.
isSuccess   boolean  
refetch   (options?: RefetchOptions) => Promise<QueryResult<TData, TError>>  
status   QueryStatus - loading - if there’s no cached data and no query attempt was finished yet. - error - if the query attempt resulted in an error. The corresponding error property has the error received from the attempted fetch. - success - if the query has received a response with no errors and is ready to display its data. The corresponding data property on the query is the data received from the successful fetch or if the query’s enabled property is set to false and has not been fetched yet data is the first initialData supplied to the query on initialization.