tridion-sites-extensions-api-docs

Home > @tridion-sites/extensions > QueryOptions

QueryOptions interface

Signature:

export interface QueryOptions<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData>

Properties

Property Modifiers Type Description
enabled?   boolean (Optional) Set this to false to disable automatic refetching when the query mounts or changes query keys. To refetch the query, use the refetch method returned from the useQuery instance. Defaults to true.
initialData?   TData | (() => TData | undefined) (Optional)
initialDataUpdatedAt?   number | (() => number | undefined) (Optional)
meta?   Record<string, unknown> (Optional)
placeholderData?   NonFunctionGuard<TQueryFnData> | ((previousData: TData | undefined) => NonFunctionGuard<TQueryFnData> | undefined) (Optional) If set, this value will be used as the placeholder data for this particular query observer while the query is still in the loading data and no initialData has been provided.
refetchInterval?   number | false (Optional) If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency. Defaults to false.
refetchIntervalInBackground?   boolean (Optional) If set to true, the query will continue to refetch while their tab/window is in the background. Defaults to false.
refetchOnMount?   boolean | ‘always’ (Optional) If set to true, the query will refetch on mount if the data is stale. If set to false, will disable additional instances of a query to trigger background refetches. If set to 'always', the query will always refetch on mount. Defaults to true.
refetchOnReconnect?   boolean | ‘always’ (Optional) If set to true, the query will refetch on reconnect if the data is stale. If set to false, the query will not refetch on reconnect. If set to 'always', the query will always refetch on reconnect. If set to a function, the function will be executed with the latest data and query to compute the value. Defaults to the value of networkOnline (true)
refetchOnWindowFocus?   boolean | ‘always’ (Optional) If set to true, the query will refetch on window focus if the data is stale. If set to false, the query will not refetch on window focus. If set to 'always', the query will always refetch on window focus. Defaults to true.
retry?   boolean | number | ((failureCount: number, error: TError) => boolean) (Optional)
retryDelay?   number | ((failureCount: number, error: TError) => number) (Optional)
retryOnMount?   boolean (Optional) If set to false, the query will not be retried on mount if it contains an error. Defaults to true.
staleTime?   number (Optional) The time in milliseconds after data is considered stale. If set to Infinity, the data will never be considered stale.