()
| 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 |
no test coverage detected