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

Method isStale

packages/query-core/src/query.ts:447–457  ·  view source on GitHub ↗

* Returns `true` if the query is stale. * - If the query has observers, defers to whether any observer's current * result reports `isStale` (which accounts for each observer's own * `staleTime` and `enabled` state). * - If the query has no observers, it is considered stale when it ha

()

Source from the content-addressed store, hash-verified

445 * ```
446 */
447 isStale(): boolean {
448 // check observers first, their `isStale` has the source of truth
449 // calculated with `isStaleByTime` and it takes `enabled` into account
450 if (this.getObserversCount() > 0) {
451 return this.observers.some(
452 (observer) => observer.getCurrentResult().isStale,
453 )
454 }
455
456 return this.state.data === undefined || this.state.isInvalidated
457 }
458
459 /**
460 * Returns `true` if the query's data is stale relative to the given

Callers 8

getQueryStateFunction · 0.80
QueryRowFunction · 0.80
getQueryStatusLabelFunction · 0.80
getStatusRankFunction · 0.80
utils.test.tsFile · 0.80
persisterFnFunction · 0.80
matchQueryFunction · 0.80

Calls 2

getObserversCountMethod · 0.95
getCurrentResultMethod · 0.45

Tested by

no test coverage detected