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

Method remove

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

* Destroys the given `Query` and removes it from the cache, notifying subscribers with a * `'removed'` event. A no-op if the query is no longer the one currently stored under its hash * (e.g. it was already replaced). Used by plugins (e.g. the broadcast client) that mirror * removals across

(query: Query<any, any, any, any>)

Source from the content-addressed store, hash-verified

206 * ```
207 */
208 remove(query: Query<any, any, any, any>): void {
209 const queryInMap = this.#queries.get(query.queryHash)
210
211 if (queryInMap === query) {
212 query.destroy()
213 this.#queries.delete(query.queryHash)
214 this.notify({ type: 'removed', query })
215 }
216 }
217
218 /**
219 * Removes all queries from the cache.

Calls 3

notifyMethod · 0.95
getMethod · 0.80
destroyMethod · 0.45

Tested by

no test coverage detected