Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

EnsureQueryDataOptions.md

322 lines8.0 KB

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

Defined in: packages/query-core/src/types.ts:509

Extends

Type Parameters

TQueryFnData

TQueryFnData = unknown

TError

TError = DefaultError

TData

TData = TQueryFnData

TQueryKey

TQueryKey extends QueryKey = QueryKey

TPageParam

TPageParam = never

Properties

_defaulted?

optional _defaulted: boolean;

Defined in: packages/query-core/src/types.ts:268

Inherited from

FetchQueryOptions._defaulted


behavior?

optional behavior: QueryBehavior<TQueryFnData, TError, TData, TQueryKey>;

Defined in: packages/query-core/src/types.ts:259

Inherited from

FetchQueryOptions.behavior


gcTime?

optional gcTime: number;

Defined in: packages/query-core/src/types.ts:247

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.

Inherited from

FetchQueryOptions.gcTime


initialData?

optional initialData: 
  | TData
| InitialDataFunction<TData>;

Defined in: packages/query-core/src/types.ts:257

Inherited from

FetchQueryOptions.initialData


initialDataUpdatedAt?

optional initialDataUpdatedAt: number | () => number | undefined;

Defined in: packages/query-core/src/types.ts:258

Inherited from

FetchQueryOptions.initialDataUpdatedAt


initialPageParam?

optional initialPageParam: undefined;

Defined in: packages/query-core/src/types.ts:501

Inherited from

FetchQueryOptions.initialPageParam


maxPages?

optional maxPages: number;

Defined in: packages/query-core/src/types.ts:277

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

Inherited from

FetchQueryOptions.maxPages


meta?

optional meta: Record<string, unknown>;

Defined in: packages/query-core/src/types.ts:273

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

Inherited from

FetchQueryOptions.meta


networkMode?

optional networkMode: NetworkMode;

Defined in: packages/query-core/src/types.ts:240

Inherited from

FetchQueryOptions.networkMode


persister?

optional persister: QueryPersister<NoInfer<TQueryFnData>, NoInfer<TQueryKey>, NoInfer<TPageParam>>;

Defined in: packages/query-core/src/types.ts:249

Inherited from

FetchQueryOptions.persister


queryFn?

optional queryFn: 
  | typeof skipToken
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;

Defined in: packages/query-core/src/types.ts:248

Inherited from

FetchQueryOptions.queryFn


queryHash?

optional queryHash: string;

Defined in: packages/query-core/src/types.ts:254

Inherited from

FetchQueryOptions.queryHash


queryKey

queryKey: TQueryKey & object;

Defined in: packages/query-core/src/types.ts:255

Inherited from

FetchQueryOptions.queryKey


queryKeyHashFn?

optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;

Defined in: packages/query-core/src/types.ts:256

Inherited from

FetchQueryOptions.queryKeyHashFn


retry?

optional retry: RetryValue<TError>;

Defined in: packages/query-core/src/types.ts:238

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.

Inherited from

FetchQueryOptions.retry


retryDelay?

optional retryDelay: RetryDelayValue<TError>;

Defined in: packages/query-core/src/types.ts:239

Inherited from

FetchQueryOptions.retryDelay


revalidateIfStale?

optional revalidateIfStale: boolean;

Defined in: packages/query-core/src/types.ts:522


staleTime?

optional staleTime: StaleTimeFunction<TQueryFnData, TError, TData, TQueryKey>;

Defined in: packages/query-core/src/types.ts:506

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

Inherited from

FetchQueryOptions.staleTime


structuralSharing?

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

Defined in: packages/query-core/src/types.ts:265

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.

Inherited from

FetchQueryOptions.structuralSharing