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

Method prefetchQuery

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

* Fetches and caches a query like QueryClient#fetchQuery, but ignores the result and any * error. * @param options - The query options, including the `queryKey` and the `queryFn` used if the * query needs to fetch. * @returns A promise that resolves once the fetch settles. It nev

(
    options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
  )

Source from the content-addressed store, hash-verified

688 * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
689 */
690 prefetchQuery<
691 TQueryFnData = unknown,
692 TError = DefaultError,
693 TData = TQueryFnData,
694 TQueryKey extends QueryKey = QueryKey,
695 >(
696 options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
697 ): Promise<void> {
698 // oxlint-disable-next-line tanstack-query/no-restricted-syntax
699 return this.fetchQuery(options).then(noop).catch(noop)
700 }
701
702 /**
703 * Asynchronous method to fetch and cache an infinite query, resolving with an

Callers 9

ensureQueryDataMethod · 0.95
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45
ExamplesFunction · 0.45

Calls 1

fetchQueryMethod · 0.95

Tested by

no test coverage detected