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

Method ensureInfiniteQueryData

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

* Returns the cached data of an infinite query, or fetches it if there is none. With * `revalidateIfStale`, stale cached data is also refetched in the background. * @param options - The infinite query options, including `initialPageParam` and `getNextPageParam`. * @returns A promise that re

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

Source from the content-addressed store, hash-verified

812 * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
813 */
814 ensureInfiniteQueryData<
815 TQueryFnData,
816 TError = DefaultError,
817 TData = TQueryFnData,
818 TQueryKey extends QueryKey = QueryKey,
819 TPageParam = unknown,
820 >(
821 options: EnsureInfiniteQueryDataOptions<
822 TQueryFnData,
823 TError,
824 TData,
825 TQueryKey,
826 TPageParam
827 >,
828 ): Promise<InfiniteData<TData, TPageParam>> {
829 options._type = 'infinite'
830
831 // oxlint-disable-next-line tanstack-query/no-restricted-syntax
832 return this.ensureQueryData(options as any)
833 }
834
835 /**
836 * Resumes mutations that were paused because there was no network connection. Does nothing

Callers 2

Calls 1

ensureQueryDataMethod · 0.95

Tested by

no test coverage detected