MCPcopy Create free account
hub / github.com/TanStack/query / clear

Method clear

packages/query-core/src/queryCache.ts:232–238  ·  view source on GitHub ↗

* Removes all queries from the cache. * * @example * ```ts * const queryCache = queryClient.getQueryCache() * * queryCache.clear() * ```

()

Source from the content-addressed store, hash-verified

230 * ```
231 */
232 clear(): void {
233 notifyManager.batch(() => {
234 this.getAll().forEach((query) => {
235 this.remove(query)
236 })
237 })
238 }
239
240 /**
241 * Returns the `Query` instance stored under the given `queryHash`, or `undefined` if none

Calls 2

getAllMethod · 0.95
removeMethod · 0.95

Tested by

no test coverage detected