@tanstack/query-core 5.102.3 → 5.102.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/hydration-BoHd-X9T.d.cts.map +1 -1
- package/build/legacy/hydration-DFwTM9vM.d.ts.map +1 -1
- package/build/legacy/queryObserver.cjs +5 -2
- package/build/legacy/queryObserver.cjs.map +1 -1
- package/build/legacy/queryObserver.js +5 -2
- package/build/legacy/queryObserver.js.map +1 -1
- package/build/modern/hydration-BoHd-X9T.d.cts.map +1 -1
- package/build/modern/hydration-DFwTM9vM.d.ts.map +1 -1
- package/build/modern/queryObserver.cjs +5 -2
- package/build/modern/queryObserver.cjs.map +1 -1
- package/build/modern/queryObserver.js +5 -2
- package/build/modern/queryObserver.js.map +1 -1
- package/package.json +1 -1
- package/src/queryObserver.ts +11 -9
package/src/queryObserver.ts
CHANGED
|
@@ -369,6 +369,14 @@ export class QueryObserver<
|
|
|
369
369
|
return promise
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
#shouldScheduleTimer(timeout: unknown): timeout is number {
|
|
373
|
+
return (
|
|
374
|
+
!environmentManager.isServer() &&
|
|
375
|
+
resolveQueryBoolean(this.options.enabled, this.#currentQuery) !== false &&
|
|
376
|
+
isValidTimeout(timeout)
|
|
377
|
+
)
|
|
378
|
+
}
|
|
379
|
+
|
|
372
380
|
#updateStaleTimeout(): void {
|
|
373
381
|
this.#clearStaleTimeout()
|
|
374
382
|
const staleTime = resolveStaleTime(
|
|
@@ -376,11 +384,7 @@ export class QueryObserver<
|
|
|
376
384
|
this.#currentQuery,
|
|
377
385
|
)
|
|
378
386
|
|
|
379
|
-
if (
|
|
380
|
-
environmentManager.isServer() ||
|
|
381
|
-
this.#currentResult.isStale ||
|
|
382
|
-
!isValidTimeout(staleTime)
|
|
383
|
-
) {
|
|
387
|
+
if (this.#currentResult.isStale || !this.#shouldScheduleTimer(staleTime)) {
|
|
384
388
|
return
|
|
385
389
|
}
|
|
386
390
|
|
|
@@ -411,10 +415,8 @@ export class QueryObserver<
|
|
|
411
415
|
this.#currentRefetchInterval = nextInterval
|
|
412
416
|
|
|
413
417
|
if (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
!isValidTimeout(this.#currentRefetchInterval) ||
|
|
417
|
-
this.#currentRefetchInterval === 0
|
|
418
|
+
this.#currentRefetchInterval === 0 ||
|
|
419
|
+
!this.#shouldScheduleTimer(this.#currentRefetchInterval)
|
|
418
420
|
) {
|
|
419
421
|
return
|
|
420
422
|
}
|