* 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'>,
)
| 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 |