* Refetches queries matching the given filters, regardless of whether they are stale. Without * filters, every query in the cache is refetched. Queries that are disabled, or static (only * have observers with a static `staleTime`), are never refetched. * * By default (`cancelRefetch: tru
(
filters?: RefetchQueryFilters<TTaggedQueryKey>,
options: RefetchOptions = {},
)
| 538 | * ``` |
| 539 | */ |
| 540 | refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>( |
| 541 | filters?: RefetchQueryFilters<TTaggedQueryKey>, |
| 542 | options: RefetchOptions = {}, |
| 543 | ): Promise<void> { |
| 544 | const fetchOptions = { |
| 545 | ...options, |
| 546 | cancelRefetch: options.cancelRefetch ?? true, |
| 547 | } |
| 548 | const promises = notifyManager.batch(() => |
| 549 | this.#queryCache |
| 550 | .findAll(filters) |
| 551 | .filter((query) => !query.isDisabled() && !query.isStatic()) |
| 552 | .map((query) => { |
| 553 | let promise = query.fetch(undefined, fetchOptions) |
| 554 | const isPaused = query.state.fetchStatus === 'paused' |
| 555 | if (!fetchOptions.throwOnError || isPaused) { |
| 556 | promise = promise.catch(noop) |
| 557 | } |
| 558 | return isPaused ? Promise.resolve() : promise |
| 559 | }), |
| 560 | ) |
| 561 | |
| 562 | return Promise.all(promises).then(noop) |
| 563 | } |
| 564 | |
| 565 | /** |
| 566 | * Asynchronous method to fetch and cache a query, resolving with the data or throwing with |
no test coverage detected