Interface EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>

interface EnsureQueryDataOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> {
    _defaulted?: boolean;
    behavior?: QueryBehavior<TQueryFnData, TError, TData, TQueryKey>;
    gcTime?: number;
    initialData?: TData | InitialDataFunction<TData>;
    initialDataUpdatedAt?: number | (() => undefined | number);
    maxPages?: number;
    meta?: Record<string, unknown>;
    networkMode?: NetworkMode;
    persister?: QueryPersister<NoInfer<TQueryFnData>, NoInfer<TQueryKey>, NoInfer<TPageParam>>;
    queryFn?: typeof skipToken | QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
    queryHash?: string;
    queryKey: TQueryKey & {};
    queryKeyHashFn?: QueryKeyHashFunction<TQueryKey>;
    retry?: RetryValue<TError>;
    retryDelay?: RetryDelayValue<TError>;
    revalidateIfStale?: boolean;
    staleTime?: StaleTime<TQueryFnData, TError, TData, TQueryKey>;
    structuralSharing?: boolean | ((oldData: unknown, newData: unknown) => unknown);
}

Type Parameters

Hierarchy (view full)

Properties

_defaulted?: boolean
behavior?: QueryBehavior<TQueryFnData, TError, TData, TQueryKey>
gcTime?: number

The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. Setting it to Infinity will disable garbage collection.

initialDataUpdatedAt?: number | (() => undefined | number)
maxPages?: number

Maximum number of pages to store in the data of an infinite query.

meta?: Record<string, unknown>

Additional payload to be stored on each query. Use this property to pass information that can be used in other places.

networkMode?: NetworkMode
queryHash?: string
queryKey: TQueryKey & {}
retry?: RetryValue<TError>

If false, failed queries will not retry by default. If true, failed queries will retry infinitely., failureCount: num If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function (failureCount, error) => boolean failed queries will retry until the function returns false.

retryDelay?: RetryDelayValue<TError>
revalidateIfStale?: boolean

The time in milliseconds after data is considered stale. If the data is fresh it will be returned from the cache.

structuralSharing?: boolean | ((oldData: unknown, newData: unknown) => unknown)

Set this to false to disable structural sharing between query results. Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic. Defaults to true.