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