Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/query-core/src/focusManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Subscribable } from './subscribable'
import { isServer } from './utils'
import { notifyManager } from './notifyManager'

type Listener = (focused: boolean) => void

Expand Down Expand Up @@ -38,7 +39,7 @@ export class FocusManager extends Subscribable<Listener> {
}
}

protected onUnsubscribe() {
protected onUnsubscribe(): void {
if (!this.hasListeners()) {
this.#cleanup?.()
this.#cleanup = undefined
Expand Down Expand Up @@ -67,8 +68,10 @@ export class FocusManager extends Subscribable<Listener> {

onFocus(): void {
const isFocused = this.isFocused()
this.listeners.forEach((listener) => {
listener(isFocused)
notifyManager.batch(() => {
this.listeners.forEach((listener) => {
listener(isFocused)
})
})
}

Expand Down