MCPcopy Create free account
hub / github.com/TanStack/query / timeUntilStale

Function timeUntilStale

packages/query-core/src/utils.ts:157–159  ·  view source on GitHub ↗
(updatedAt: number, staleTime?: number)

Source from the content-addressed store, hash-verified

155 * @returns The remaining time in milliseconds, or `0` if the data is already stale.
156 */
157export function timeUntilStale(updatedAt: number, staleTime?: number): number {
158 return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0)
159}
160
161/**
162 * Resolves an option that can be given either as a value or as a function of the query, such as

Callers 3

#updateStaleTimeoutMethod · 0.90
isStaleByTimeMethod · 0.90
utils.test-d.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected