Interface: InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>#
Defined in: packages/query-core/src/types.ts:458
Extends#
QueryObserverOptions<TQueryFnData,TError,TData,InfiniteData<TQueryFnData,TPageParam>,TQueryKey,TPageParam>.InfiniteQueryPageParamsOptions<TQueryFnData,TPageParam>
Type Parameters#
TQueryFnData#
TQueryFnData = unknown
TError#
TError = DefaultError
TData#
TData = TQueryFnData
TQueryKey#
TQueryKey extends QueryKey = QueryKey
TPageParam#
TPageParam = unknown
Properties#
_defaulted?#
optional _defaulted: boolean;
Defined in: packages/query-core/src/types.ts:268
Inherited from#
QueryObserverOptions._defaulted
_optimisticResults?#
optional _optimisticResults: "optimistic" | "isRestoring";
Defined in: packages/query-core/src/types.ts:435
Inherited from#
QueryObserverOptions._optimisticResults
behavior?#
optional behavior: QueryBehavior<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
Defined in: packages/query-core/src/types.ts:259
Inherited from#
enabled?#
optional enabled: Enabled<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
Defined in: packages/query-core/src/types.ts:329
Set this to false or a function that returns 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.
Accepts a boolean or function that returns a boolean.
Defaults to true.
Inherited from#
experimental_prefetchInRender?#
optional experimental_prefetchInRender: boolean;
Defined in: packages/query-core/src/types.ts:440
Enable prefetching during rendering
Inherited from#
QueryObserverOptions.experimental_prefetchInRender
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#
getNextPageParam#
getNextPageParam: GetNextPageParamFunction<TPageParam, TQueryFnData>;
Defined in: packages/query-core/src/types.ts:297
This function can be set to automatically get the next cursor for infinite queries.
The result will also be used to determine the value of hasNextPage.
Inherited from#
InfiniteQueryPageParamsOptions.getNextPageParam
getPreviousPageParam?#
optional getPreviousPageParam: GetPreviousPageParamFunction<TPageParam, TQueryFnData>;
Defined in: packages/query-core/src/types.ts:292
This function can be set to automatically get the previous cursor for infinite queries.
The result will also be used to determine the value of hasPreviousPage.
Inherited from#
InfiniteQueryPageParamsOptions.getPreviousPageParam
initialData?#
optional initialData:
| InfiniteData<TQueryFnData, TPageParam>
| InitialDataFunction<InfiniteData<TQueryFnData, TPageParam>>;
Defined in: packages/query-core/src/types.ts:257
Inherited from#
QueryObserverOptions.initialData
initialDataUpdatedAt?#
optional initialDataUpdatedAt: number | () => number | undefined;
Defined in: packages/query-core/src/types.ts:258
Inherited from#
QueryObserverOptions.initialDataUpdatedAt
initialPageParam#
initialPageParam: TPageParam;
Defined in: packages/query-core/src/types.ts:281
Inherited from#
InfiniteQueryPageParamsOptions.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#
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#
networkMode?#
optional networkMode: NetworkMode;
Defined in: packages/query-core/src/types.ts:240
Inherited from#
QueryObserverOptions.networkMode
notifyOnChangeProps?#
optional notifyOnChangeProps: NotifyOnChangeProps;
Defined in: packages/query-core/src/types.ts:404
If set, the component will only re-render if any of the listed properties change.
When set to ['data', 'error'], the component will only re-render when the data or error properties change.
When set to 'all', the component will re-render whenever a query is updated.
When set to a function, the function will be executed to compute the list of properties.
By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change.
Inherited from#
QueryObserverOptions.notifyOnChangeProps
persister?#
optional persister: QueryPersister<NoInfer<TQueryFnData>, NoInfer<TQueryKey>, NoInfer<TPageParam>>;
Defined in: packages/query-core/src/types.ts:249
Inherited from#
QueryObserverOptions.persister
placeholderData?#
optional placeholderData:
| InfiniteData<TQueryFnData, TPageParam>
| PlaceholderDataFunction<InfiniteData<TQueryFnData, TPageParam>, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
Defined in: packages/query-core/src/types.ts:426
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.
Inherited from#
QueryObserverOptions.placeholderData
queryFn?#
optional queryFn:
| typeof skipToken
| QueryFunction<TQueryFnData, TQueryKey, TPageParam>;
Defined in: packages/query-core/src/types.ts:248
Inherited from#
queryHash?#
optional queryHash: string;
Defined in: packages/query-core/src/types.ts:254
Inherited from#
QueryObserverOptions.queryHash
queryKey#
queryKey: TQueryKey & object;
Defined in: packages/query-core/src/types.ts:255
Inherited from#
queryKeyHashFn?#
optional queryKeyHashFn: QueryKeyHashFunction<TQueryKey>;
Defined in: packages/query-core/src/types.ts:256
Inherited from#
QueryObserverOptions.queryKeyHashFn
refetchInterval?#
optional refetchInterval: number | false | (query) => number | false | undefined;
Defined in: packages/query-core/src/types.ts:342
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.
Inherited from#
QueryObserverOptions.refetchInterval
refetchIntervalInBackground?#
optional refetchIntervalInBackground: boolean;
Defined in: packages/query-core/src/types.ts:352
If set to true, the query will continue to refetch while their tab/window is in the background.
Defaults to false.
Inherited from#
QueryObserverOptions.refetchIntervalInBackground
refetchOnMount?#
optional refetchOnMount: boolean | "always" | (query) => boolean | "always";
Defined in: packages/query-core/src/types.ts:386
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 refetch.
If set to 'always', the query will always refetch on mount.
If set to a function, the function will be executed with the latest data and query to compute the value
Defaults to true.
Inherited from#
QueryObserverOptions.refetchOnMount
refetchOnReconnect?#
optional refetchOnReconnect: boolean | "always" | (query) => boolean | "always";
Defined in: packages/query-core/src/types.ts:373
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)
Inherited from#
QueryObserverOptions.refetchOnReconnect
refetchOnWindowFocus?#
optional refetchOnWindowFocus: boolean | "always" | (query) => boolean | "always";
Defined in: packages/query-core/src/types.ts:360
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.
If set to a function, the function will be executed with the latest data and query to compute the value.
Defaults to true.
Inherited from#
QueryObserverOptions.refetchOnWindowFocus
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#
retryDelay?#
optional retryDelay: RetryDelayValue<TError>;
Defined in: packages/query-core/src/types.ts:239
Inherited from#
QueryObserverOptions.retryDelay
retryOnMount?#
optional retryOnMount: boolean;
Defined in: packages/query-core/src/types.ts:396
If set to false, the query will not be retried on mount if it contains an error.
Defaults to true.
Inherited from#
QueryObserverOptions.retryOnMount
select()?#
optional select: (data) => TData;
Defined in: packages/query-core/src/types.ts:416
This option can be used to transform or select a part of the data returned by the query function.
Parameters#
data#
Returns#
TData
Inherited from#
staleTime?#
optional staleTime: StaleTimeFunction<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
Defined in: packages/query-core/src/types.ts:336
The time in milliseconds after data is considered stale.
If set to Infinity, the data will never be considered stale.
If set to a function, the function will be executed with the query to compute a staleTime.
Defaults to 0.
Inherited from#
QueryObserverOptions.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#
QueryObserverOptions.structuralSharing
suspense?#
optional suspense: boolean;
Defined in: packages/query-core/src/types.ts:422
If set to true, the query will suspend when status === 'pending'
and throw errors when status === 'error'.
Defaults to false.
Inherited from#
throwOnError?#
optional throwOnError: ThrowOnError<TQueryFnData, TError, InfiniteData<TQueryFnData, TPageParam>, TQueryKey>;
Defined in: packages/query-core/src/types.ts:412
Whether errors should be thrown instead of setting the error property.
If set to true or suspense is true, all errors will be thrown to the error boundary.
If set to false and suspense is false, errors are returned as state.
If set to a function, it will be passed the error and the query, and it should return a boolean indicating whether to show the error in an error boundary (true) or return the error as state (false).
Defaults to false.