@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.
@@ -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
- environmentManager.isServer() ||
415
- resolveQueryBoolean(this.options.enabled, this.#currentQuery) === false ||
416
- !isValidTimeout(this.#currentRefetchInterval) ||
417
- this.#currentRefetchInterval === 0
418
+ this.#currentRefetchInterval === 0 ||
419
+ !this.#shouldScheduleTimer(this.#currentRefetchInterval)
418
420
  ) {
419
421
  return
420
422
  }