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

Method isStale

packages/query-core/src/query.ts:302–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

300 }
301
302 isStale(): boolean {
303 // check observers first, their `isStale` has the source of truth
304 // calculated with `isStaleByTime` and it takes `enabled` into account
305 if (this.getObserversCount() > 0) {
306 return this.observers.some(
307 (observer) => observer.getCurrentResult().isStale,
308 )
309 }
310
311 return this.state.data === undefined || this.state.isInvalidated
312 }
313
314 isStaleByTime(staleTime: StaleTime = 0): boolean {
315 // no data is always stale

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