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

Method remove

packages/query-core/src/queryCache.ts:235–243  ·  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

233 * ```
234 */
235 remove(query: Query<any, any, any, any>): void {
236 const queryInMap = this.#queries.get(query.queryHash)
237
238 if (queryInMap === query) {
239 query.destroy()
240 this.#queries.delete(query.queryHash)
241 this.notify({ type: 'removed', query })
242 }
243 }
244
245 /**
246 * Removes all queries from the cache.

Calls 3

notifyMethod · 0.95
getMethod · 0.80
destroyMethod · 0.45

Tested by

no test coverage detected