* Resets queries matching the given filters back to their initial state (e.g. any * `initialData`), notifying subscribers rather than removing them. Active queries among the * matched set are then refetched, and the returned promise resolves once that refetch settles. * * @example * `
(
filters?: QueryFilters<TTaggedQueryKey>,
options?: ResetOptions,
)
| 397 | * ``` |
| 398 | */ |
| 399 | resetQueries<TTaggedQueryKey extends QueryKey = QueryKey>( |
| 400 | filters?: QueryFilters<TTaggedQueryKey>, |
| 401 | options?: ResetOptions, |
| 402 | ): Promise<void> { |
| 403 | const queryCache = this.#queryCache |
| 404 | |
| 405 | return notifyManager.batch(() => { |
| 406 | const matched = queryCache.findAll(filters) |
| 407 | const queriesToRefetch = new Set(matched) |
| 408 | matched.forEach((query) => { |
| 409 | query.reset() |
| 410 | }) |
| 411 | return this.refetchQueries( |
| 412 | { |
| 413 | type: 'active', |
| 414 | predicate: (query) => queriesToRefetch.has(query), |
| 415 | }, |
| 416 | options, |
| 417 | ) |
| 418 | }) |
| 419 | } |
| 420 | |
| 421 | /** |
| 422 | * Cancels outgoing fetches for queries matching the given filters. Most useful when performing |
no test coverage detected