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

Method fetchFn

packages/query-core/src/query.ts:650–679  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

648
649 // Create fetch function
650 const fetchFn = () => {
651 const queryFn = ensureQueryFn(this.options, fetchOptions)
652
653 // Create query function context
654 const createQueryFnContext = (): QueryFunctionContext<TQueryKey> => {
655 const queryFnContext: OmitKeyof<
656 QueryFunctionContext<TQueryKey>,
657 'signal'
658 > = {
659 client: this.#client,
660 queryKey: this.queryKey,
661 meta: this.meta,
662 }
663 addSignalProperty(queryFnContext)
664 return queryFnContext as QueryFunctionContext<TQueryKey>
665 }
666
667 const queryFnContext = createQueryFnContext()
668
669 this.#abortSignalConsumed = false
670 if (this.options.persister) {
671 return this.options.persister(
672 queryFn,
673 queryFnContext,
674 this as unknown as Query,
675 )
676 }
677
678 return queryFn(queryFnContext)
679 }
680
681 // Trigger behavior hook
682 const createFetchContext = (): FetchContext<

Callers 1

Calls 3

ensureQueryFnFunction · 0.90
createQueryFnContextFunction · 0.85
queryFnFunction · 0.50

Tested by

no test coverage detected