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

Method onFocus

packages/query-core/src/query.ts:589–596  ·  view source on GitHub ↗

* Refetches the query when the window regains focus, if an observer wants that, and continues a * paused fetch. * @internal

()

Source from the content-addressed store, hash-verified

587 * @internal
588 */
589 onFocus(): void {
590 const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus())
591
592 observer?.refetch({ cancelRefetch: false })
593
594 // Continue fetch if currently paused
595 this.#retryer?.continue()
596 }
597
598 /**
599 * Refetches the query when the app reconnects, if an observer wants that, and continues a paused

Callers 1

mountMethod · 0.45

Calls 4

refetchMethod · 0.80
continueMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected