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

Method ensureInfiniteQueryData

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

816 * @deprecated Use queryClient.infiniteQuery({ ...options, staleTime: 'static' }) instead. This method will be removed in the next major version.
817 */
818 ensureInfiniteQueryData<
819 TQueryFnData,
820 TError = DefaultError,
821 TData = TQueryFnData,
822 TQueryKey extends QueryKey = QueryKey,
823 TPageParam = unknown,
824 >(
825 options: EnsureInfiniteQueryDataOptions<
826 TQueryFnData,
827 TError,
828 TData,
829 TQueryKey,
830 TPageParam
831 >,
832 ): Promise<InfiniteData<TData, TPageParam>> {
833 options._type = 'infinite'
834
835 // oxlint-disable-next-line tanstack-query/no-restricted-syntax
836 return this.ensureQueryData(options as any)
837 }
838
839 /**
840 * 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