tRPCttRPC
Powered by
JokcyJ
tRPC•3y ago•
5 replies
Jokcy

Cache not working for `useQuery`

I have a query like this:
const { data: article, isFetching } = api.public.getArticle.useQuery({
        id: targetId,
    });
const { data: article, isFetching } = api.public.getArticle.useQuery({
        id: targetId,
    });

which
targetId
targetId
is a dynamic value. When I change
targetId
targetId
from a to b then switch back from b to a, the
useQuery
useQuery
hook still send a new request for
a
a
instead of using cache. Any idea how to make the cache work?
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

`useQuery` not working?
SansPapyrus683SSansPapyrus683 / ❓-help
3y ago
UseQuery iterator not working for me
balakayBbalakay / ❓-help
2y ago
useQuery enabled not working???
taylor.prestoTtaylor.presto / ❓-help
4y ago