* Returns `true` if the query has data and at least one observer configured with * `staleTime: 'static'`, meaning it is treated as never stale. * @returns `true` if the query is static.
()
| 506 | * @returns `true` if the query is static. |
| 507 | */ |
| 508 | isStatic(): boolean { |
| 509 | if (this.state.data === undefined) { |
| 510 | return false |
| 511 | } |
| 512 | |
| 513 | if (this.getObserversCount() > 0) { |
| 514 | return this.observers.some( |
| 515 | (observer) => |
| 516 | resolveQueryValue(observer.options.staleTime, this) === 'static', |
| 517 | ) |
| 518 | } |
| 519 | |
| 520 | return false |
| 521 | } |
| 522 | |
| 523 | /** |
| 524 | * Returns `true` if the query is stale. |
no test coverage detected