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

Method prefetchQuery

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

* @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.

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

Source from the content-addressed store, hash-verified

634 * @deprecated Use queryClient.query(options) instead. You can swallow errors with `.catch(noop)`. This method will be removed in the next major version.
635 */
636 prefetchQuery<
637 TQueryFnData = unknown,
638 TError = DefaultError,
639 TData = TQueryFnData,
640 TQueryKey extends QueryKey = QueryKey,
641 >(
642 options: FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
643 ): Promise<void> {
644 // eslint-disable-next-line no-restricted-syntax
645 return this.fetchQuery(options).then(noop).catch(noop)
646 }
647
648 /**
649 * 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