* Imperative (non-reactive) way to retrieve an existing query's state. If the query does not * exist, `undefined` is returned. * @param queryKey - The query key of the query to read. * @returns The query's state, or `undefined` if no query with this key exists. * @example * ```ts *
(
queryKey: TTaggedQueryKey,
)
| 369 | * ``` |
| 370 | */ |
| 371 | getQueryState< |
| 372 | TQueryFnData = unknown, |
| 373 | TError = DefaultError, |
| 374 | TTaggedQueryKey extends QueryKey = QueryKey, |
| 375 | TInferredQueryFnData = InferDataFromTag<TQueryFnData, TTaggedQueryKey>, |
| 376 | TInferredError = InferErrorFromTag<TError, TTaggedQueryKey>, |
| 377 | >( |
| 378 | queryKey: TTaggedQueryKey, |
| 379 | ): QueryState<TInferredQueryFnData, TInferredError> | undefined { |
| 380 | const options = this.defaultQueryOptions({ queryKey }) |
| 381 | return this.#queryCache.get<TInferredQueryFnData, TInferredError>( |
| 382 | options.queryHash, |
| 383 | )?.state |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Removes queries from the cache that match the given filters. Unlike |
no test coverage detected