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

FetchQueryOptions.md

340 lines6.8 KB

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

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

Extends

Extended by

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

WithRequired._defaulted

behavior?

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

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

Inherited from

WithRequired.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

WithRequired.gcTime

initialData?

optional initialData: 
  | TData
| InitialDataFunction<TData>;

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

Inherited from

WithRequired.initialData

initialDataUpdatedAt?

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

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

Inherited from

WithRequired.initialDataUpdatedAt

initialPageParam?

optional initialPageParam: undefined;

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


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

WithRequired.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

WithRequired.meta

networkMode?

optional networkMode: NetworkMode;

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

Inherited from

WithRequired.networkMode

persister?

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

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

Inherited from

WithRequired.persister

queryFn?

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

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

Inherited from

WithRequired.queryFn

queryHash?

optional queryHash: string;

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

Inherited from

WithRequired.queryHash

queryKey

queryKey: TQueryKey & object;

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

Inherited from

WithRequired.queryKey

queryKeyHashFn?

optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;

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

Inherited from

WithRequired.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

WithRequired.retry

retryDelay?

optional retryDelay: RetryDelayValue<TError>;

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

Inherited from

WithRequired.retryDelay

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.


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

WithRequired.structuralSharing