* Removes all mutations from the cache. * @example * ```ts * const mutationCache = queryClient.getMutationCache() * * mutationCache.clear() * ```
()
| 260 | * ``` |
| 261 | */ |
| 262 | clear(): void { |
| 263 | notifyManager.batch(() => { |
| 264 | const mutations = this.getAll() |
| 265 | this.#mutations.clear() |
| 266 | this.#scopes.clear() |
| 267 | mutations.forEach((mutation) => { |
| 268 | this.notify({ type: 'removed', mutation }) |
| 269 | }) |
| 270 | }) |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Returns all mutations within the cache. |