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