@tanstack/query-core
Advanced tools
Comparing version 5.25.0 to 5.26.3
import { Subscribable } from './subscribable.js'; | ||
type Listener = (focused: boolean) => void; | ||
type SetupFn = (setFocused: (focused?: boolean) => void) => (() => void) | undefined; | ||
declare class FocusManager extends Subscribable { | ||
declare class FocusManager extends Subscribable<Listener> { | ||
#private; | ||
@@ -6,0 +7,0 @@ constructor(); |
@@ -60,4 +60,5 @@ import { | ||
onFocus() { | ||
const isFocused = this.isFocused(); | ||
this.listeners.forEach((listener) => { | ||
listener(); | ||
listener(isFocused); | ||
}); | ||
@@ -64,0 +65,0 @@ } |
@@ -45,4 +45,4 @@ import { | ||
return; | ||
__privateSet(this, _unsubscribeFocus, focusManager.subscribe(() => { | ||
if (focusManager.isFocused()) { | ||
__privateSet(this, _unsubscribeFocus, focusManager.subscribe((focused) => { | ||
if (focused) { | ||
this.resumePausedMutations(); | ||
@@ -49,0 +49,0 @@ __privateGet(this, _queryCache).onFocus(); |
import { Subscribable } from './subscribable.js'; | ||
type Listener = (focused: boolean) => void; | ||
type SetupFn = (setFocused: (focused?: boolean) => void) => (() => void) | undefined; | ||
declare class FocusManager extends Subscribable { | ||
declare class FocusManager extends Subscribable<Listener> { | ||
#private; | ||
@@ -6,0 +7,0 @@ constructor(); |
@@ -51,4 +51,5 @@ // src/focusManager.ts | ||
onFocus() { | ||
const isFocused = this.isFocused(); | ||
this.listeners.forEach((listener) => { | ||
listener(); | ||
listener(isFocused); | ||
}); | ||
@@ -55,0 +56,0 @@ } |
@@ -37,4 +37,4 @@ // src/queryClient.ts | ||
return; | ||
this.#unsubscribeFocus = focusManager.subscribe(() => { | ||
if (focusManager.isFocused()) { | ||
this.#unsubscribeFocus = focusManager.subscribe((focused) => { | ||
if (focused) { | ||
this.resumePausedMutations(); | ||
@@ -41,0 +41,0 @@ this.#queryCache.onFocus(); |
{ | ||
"name": "@tanstack/query-core", | ||
"version": "5.25.0", | ||
"version": "5.26.3", | ||
"description": "The framework agnostic core that powers TanStack Query", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
import { Subscribable } from './subscribable' | ||
import { isServer } from './utils' | ||
type Listener = (focused: boolean) => void | ||
type SetupFn = ( | ||
@@ -8,3 +10,3 @@ setFocused: (focused?: boolean) => void, | ||
export class FocusManager extends Subscribable { | ||
export class FocusManager extends Subscribable<Listener> { | ||
#focused?: boolean | ||
@@ -68,4 +70,5 @@ #cleanup?: () => void | ||
onFocus(): void { | ||
const isFocused = this.isFocused() | ||
this.listeners.forEach((listener) => { | ||
listener() | ||
listener(isFocused) | ||
}) | ||
@@ -72,0 +75,0 @@ } |
@@ -78,4 +78,4 @@ import { | ||
this.#unsubscribeFocus = focusManager.subscribe(() => { | ||
if (focusManager.isFocused()) { | ||
this.#unsubscribeFocus = focusManager.subscribe((focused) => { | ||
if (focused) { | ||
this.resumePausedMutations() | ||
@@ -82,0 +82,0 @@ this.#queryCache.onFocus() |
@@ -60,11 +60,1 @@ import { vi } from 'vitest' | ||
} | ||
export const doNotExecute = (_func: () => void) => true | ||
export type Equal<TTargetA, TTargetB> = (<T>() => T extends TTargetA | ||
? 1 | ||
: 2) extends <T>() => T extends TTargetB ? 1 : 2 | ||
? true | ||
: false | ||
export type Expect<T extends true> = T |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1838945
287
26108