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

Method setFocused

packages/query-core/src/focusManager.ts:108–114  ·  view source on GitHub ↗

* `setFocused` can be used to manually set the focus state. Set `undefined` * to fall back to the default focus check. * @param focused - The focus state, or `undefined` to use the default focus check. * @example * ```ts * import { focusManager } from '@tanstack/query-core' * *

(focused?: boolean)

Source from the content-addressed store, hash-verified

106 * ```
107 */
108 setFocused(focused?: boolean): void {
109 const changed = this.#focused !== focused
110 if (changed) {
111 this.#focused = focused
112 this.onFocus()
113 }
114 }
115
116 /**
117 * `onFocus` notifies all subscribed listeners with the current focus state.

Callers 9

setEventListenerMethod · 0.95
useQuery.test.tsxFile · 0.80
retryer.test.tsxFile · 0.80
mutation.test.tsxFile · 0.80
query.test.tsxFile · 0.80
onAppStateChangeFunction · 0.80

Calls 1

onFocusMethod · 0.95

Tested by

no test coverage detected