T
TanStack3y ago
wise-white

QueriesObserver not working

Hello, I'm trying to use queriesObserver, but it doesn't seem to be working.
const observer = new QueriesObserver(queryClient, { queryKey: "me" });
const observer = new QueriesObserver(queryClient, { queryKey: "me" });
gives me error on "queryKey": Object literal may only specify known properties, and 'queryKey' does not exist in type 'QueryObserverOptions<unknown, unknown, unknown, unknown, QueryKey>[]'. And in browser
No description
5 Replies
noble-gold
noble-gold3y ago
what are you trying to achieve with that?
wise-white
wise-whiteOP3y ago
As I understood it's useful for getting info about the state of query, so I wanted to use it to know when it has succeeded in other part of the app, but just inlcuding it breaks the code
noble-gold
noble-gold3y ago
Where did you get that information from? Obervers are a core api; for react, you usually want useQuery or useQueries. And it breaks because you're not using it correctly, it needs an array of queries passed. Anyways, you very likely don't need it
wise-white
wise-whiteOP3y ago
https://tanstack.com/query/latest/docs/react/reference/QueryObserver I followed this 'example' for the structure (I also tried ['me'] for query keys, but thanks for response. I'll try looking for something else
noble-gold
noble-gold3y ago
This is QueryObserver - you've been using QueriesObserver. Not the same thing

Did you find this page helpful?