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

Method find

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

297 * ```
298 */
299 find<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData>(
300 filters: WithRequired<QueryFilters, 'queryKey'>,
301 ): Query<TQueryFnData, TError, TData> | undefined {
302 const defaultedFilters = { exact: true, ...filters }
303
304 return this.getAll().find((query) =>
305 matchQuery(defaultedFilters, query),
306 ) as Query<TQueryFnData, TError, TData> | undefined
307 }
308
309 /**
310 * 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