MCPcopy
hub / github.com/TanStack/query / isStale

Method isStale

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

Source from the content-addressed store, hash-verified

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

Callers 7

getQueryStateFunction · 0.80
QueryRowFunction · 0.80
getQueryStatusLabelFunction · 0.80
getStatusRankFunction · 0.80
persisterFnFunction · 0.80
matchQueryFunction · 0.80

Calls 2

getObserversCountMethod · 0.95
getCurrentResultMethod · 0.45

Tested by

no test coverage detected