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

Method infiniteQuery

packages/query-core/src/queryClient.ts:730–751  ·  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

728 * ```
729 */
730 infiniteQuery<
731 TQueryFnData,
732 TError = DefaultError,
733 TData = InfiniteData<TQueryFnData>,
734 TQueryKey extends QueryKey = QueryKey,
735 TPageParam = unknown,
736 >(
737 options: InfiniteQueryExecuteOptions<
738 TQueryFnData,
739 TError,
740 TData,
741 TQueryKey,
742 TPageParam
743 >,
744 ): Promise<
745 Array<TData> extends Array<InfiniteData<TQueryFnData>>
746 ? InfiniteData<TQueryFnData, TPageParam>
747 : TData
748 > {
749 options._type = 'infinite'
750 return this.query(options as any)
751 }
752
753 /**
754 * 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