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