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

Method ensureInfiniteQueryData

packages/query-core/src/queryClient.ts:813–832  ·  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. If the query has no cached data yet, it is fetched * with these options. * @re

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

Source from the content-addressed store, hash-verified

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