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

Method add

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

* Adds a query to the cache. * @internal * @param query - The query to add. If a query with the same hash is already cached, nothing * happens.

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

Source from the content-addressed store, hash-verified

206 * happens.
207 */
208 add(query: Query<any, any, any, any>): void {
209 if (!this.#queries.has(query.queryHash)) {
210 this.#queries.set(query.queryHash, query)
211
212 this.notify({
213 type: 'added',
214 query,
215 })
216 }
217 }
218
219 /**
220 * Destroys the given `Query` and removes it from the cache, notifying subscribers with a

Callers 15

buildMethod · 0.95
mountFunction · 0.45
resolveQueryClientSourceFunction · 0.45
addRootFunction · 0.45
addFullFunction · 0.45
collectTypeIdentifiersFunction · 0.45
HighlightedTextFunction · 0.45
createSearchTextFunction · 0.45

Calls 1

notifyMethod · 0.95

Tested by 3

setupMatchMediaMockFunction · 0.36
observeMethod · 0.36
storeFunction · 0.36