* 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 = {},
)
| 497 | * ``` |
| 498 | */ |
| 499 | refetchQueries<TTaggedQueryKey extends QueryKey = QueryKey>( |
| 500 | filters?: RefetchQueryFilters<TTaggedQueryKey>, |
| 501 | options: RefetchOptions = {}, |
| 502 | ): Promise<void> { |
| 503 | const fetchOptions = { |
| 504 | ...options, |
| 505 | cancelRefetch: options.cancelRefetch ?? true, |
| 506 | } |
| 507 | const promises = notifyManager.batch(() => |
| 508 | this.#queryCache |
| 509 | .findAll(filters) |
| 510 | .filter((query) => !query.isDisabled() && !query.isStatic()) |
| 511 | .map((query) => { |
| 512 | let promise = query.fetch(undefined, fetchOptions) |
| 513 | if (!fetchOptions.throwOnError) { |
| 514 | promise = promise.catch(noop) |
| 515 | } |
| 516 | return query.state.fetchStatus === 'paused' |
| 517 | ? Promise.resolve() |
| 518 | : promise |
| 519 | }), |
| 520 | ) |
| 521 | |
| 522 | return Promise.all(promises).then(noop) |
| 523 | } |
| 524 | |
| 525 | /** |
| 526 | * Asynchronous method to fetch and cache a query, resolving with the data or throwing with |
no test coverage detected