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

Method find

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

* A slightly more advanced method that can be used to get an existing query instance from the * cache. This instance not only contains all the state for the query, but all of the instances, * and underlying guts of the query as well. If the query does not exist, `undefined` is * returned.

(
    filters: WithRequired<QueryFilters, 'queryKey'>,
  )

Source from the content-addressed store, hash-verified

322 * ```
323 */
324 find<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData>(
325 filters: WithRequired<QueryFilters, 'queryKey'>,
326 ): Query<TQueryFnData, TError, TData> | undefined {
327 const defaultedFilters = { exact: true, ...filters }
328
329 return this.getAll().find((query) =>
330 matchQuery(defaultedFilters, query),
331 ) as Query<TQueryFnData, TError, TData> | undefined
332 }
333
334 /**
335 * An even more advanced method that can be used to get existing query instances from the cache

Callers 15

ExamplesFunction · 0.95
ExamplesFunction · 0.95
ExamplesFunction · 0.95
ExamplesFunction · 0.95
findImportSpecifiersFunction · 0.45
findAllMethodCallsFunction · 0.45
transformUsagesFunction · 0.45

Calls 2

getAllMethod · 0.95
matchQueryFunction · 0.90

Tested by 1

createQueryFunction · 0.36