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