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

Method isStale

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

Source from the content-addressed store, hash-verified

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