(staleTime: StaleTime = 0)
| 314 | } |
| 315 | |
| 316 | isStaleByTime(staleTime: StaleTime = 0): boolean { |
| 317 | // no data is always stale |
| 318 | if (this.state.data === undefined) { |
| 319 | return true |
| 320 | } |
| 321 | // static is never stale |
| 322 | if (staleTime === 'static') { |
| 323 | return false |
| 324 | } |
| 325 | // if the query is invalidated, it is stale |
| 326 | if (this.state.isInvalidated) { |
| 327 | return true |
| 328 | } |
| 329 | |
| 330 | return !timeUntilStale(this.state.dataUpdatedAt, staleTime) |
| 331 | } |
| 332 | |
| 333 | onFocus(): void { |
| 334 | const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus()) |
no test coverage detected