MCPcopy Create free account
hub / github.com/TanStack/query / infiniteQuery

Method infiniteQuery

packages/query-core/src/queryClient.ts:734–755  ·  view source on GitHub ↗

* Asynchronous method to fetch and cache an infinite query, resolving with an * InfiniteData object or throwing with the error. * * Requires `initialPageParam` and `getNextPageParam`. Use `pages` to specify how many * pages to fetch. If you omit `pages`, the client fetches up to

(
    options: InfiniteQueryExecuteOptions<
      TQueryFnData,
      TError,
      TData,
      TQueryKey,
      TPageParam
    >,
  )

Source from the content-addressed store, hash-verified

732 * ```
733 */
734 infiniteQuery<
735 TQueryFnData,
736 TError = DefaultError,
737 TData = InfiniteData<TQueryFnData>,
738 TQueryKey extends QueryKey = QueryKey,
739 TPageParam = unknown,
740 >(
741 options: InfiniteQueryExecuteOptions<
742 TQueryFnData,
743 TError,
744 TData,
745 TQueryKey,
746 TPageParam
747 >,
748 ): Promise<
749 Array<TData> extends Array<InfiniteData<TQueryFnData>>
750 ? InfiniteData<TQueryFnData, TPageParam>
751 : TData
752 > {
753 options._type = 'infinite'
754 return this.query(options as any)
755 }
756
757 /**
758 * Fetches and caches an infinite query, or returns its cached data if it isn't stale.

Calls 1

queryMethod · 0.95

Tested by

no test coverage detected