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

Method fetchFn

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

Source from the content-addressed store, hash-verified

455
456 // Create fetch function
457 const fetchFn = () => {
458 const queryFn = ensureQueryFn(this.options, fetchOptions)
459
460 // Create query function context
461 const createQueryFnContext = (): QueryFunctionContext<TQueryKey> => {
462 const queryFnContext: OmitKeyof<
463 QueryFunctionContext<TQueryKey>,
464 'signal'
465 > = {
466 client: this.#client,
467 queryKey: this.queryKey,
468 meta: this.meta,
469 }
470 addSignalProperty(queryFnContext)
471 return queryFnContext as QueryFunctionContext<TQueryKey>
472 }
473
474 const queryFnContext = createQueryFnContext()
475
476 this.#abortSignalConsumed = false
477 if (this.options.persister) {
478 return this.options.persister(
479 queryFn,
480 queryFnContext,
481 this as unknown as Query,
482 )
483 }
484
485 return queryFn(queryFnContext)
486 }
487
488 // Trigger behavior hook
489 const createFetchContext = (): FetchContext<

Callers 1

Calls 3

ensureQueryFnFunction · 0.90
createQueryFnContextFunction · 0.85
queryFnFunction · 0.50

Tested by

no test coverage detected