@tanstack/react-query
Advanced tools
Comparing version 5.62.12 to 5.62.14
// src/suspense.ts | ||
var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
var ensureSuspenseTimers = (defaultedOptions) => { | ||
const originalStaleTime = defaultedOptions.staleTime; | ||
if (defaultedOptions.suspense) { | ||
if (defaultedOptions.staleTime === void 0) { | ||
defaultedOptions.staleTime = 1e3; | ||
} | ||
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => Math.max(originalStaleTime(...args), 1e3) : Math.max(originalStaleTime ?? 1e3, 1e3); | ||
if (typeof defaultedOptions.gcTime === "number") { | ||
@@ -9,0 +8,0 @@ defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3); |
// src/suspense.ts | ||
var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
var ensureSuspenseTimers = (defaultedOptions) => { | ||
const originalStaleTime = defaultedOptions.staleTime; | ||
if (defaultedOptions.suspense) { | ||
if (defaultedOptions.staleTime === void 0) { | ||
defaultedOptions.staleTime = 1e3; | ||
} | ||
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => Math.max(originalStaleTime(...args), 1e3) : Math.max(originalStaleTime ?? 1e3, 1e3); | ||
if (typeof defaultedOptions.gcTime === "number") { | ||
@@ -9,0 +8,0 @@ defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3); |
{ | ||
"name": "@tanstack/react-query", | ||
"version": "5.62.12", | ||
"version": "5.62.14", | ||
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -24,8 +24,12 @@ import type { | ||
) => { | ||
const originalStaleTime = defaultedOptions.staleTime | ||
if (defaultedOptions.suspense) { | ||
// Always set stale time when using suspense to prevent | ||
// fetching again when directly mounting after suspending | ||
if (defaultedOptions.staleTime === undefined) { | ||
defaultedOptions.staleTime = 1000 | ||
} | ||
// Handle staleTime to ensure minimum 1000ms in Suspense mode | ||
// This prevents unnecessary refetching when components remount after suspending | ||
defaultedOptions.staleTime = | ||
typeof originalStaleTime === 'function' | ||
? (...args) => Math.max(originalStaleTime(...args), 1000) | ||
: Math.max(originalStaleTime ?? 1000, 1000) | ||
if (typeof defaultedOptions.gcTime === 'number') { | ||
@@ -32,0 +36,0 @@ defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1000) |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
711634
8594