tRPCttRPC
Powered by
typedefT
tRPC•3y ago•
14 replies
typedef

useContext not Invalidating

What are the possible mistakes if useContext wont invalidate when doing the following:
const utils = trpc.useContext();
const user = trpc.user.getUser.useQuery();
const updateUser = trpc.user.updateUser.useMutation({
  onSuccess: () => {
    utils.user.getUser.invalidate();
  }
});
const utils = trpc.useContext();
const user = trpc.user.getUser.useQuery();
const updateUser = trpc.user.updateUser.useMutation({
  onSuccess: () => {
    utils.user.getUser.invalidate();
  }
});


Used to work before but stopped working when I turned my entire repo to turborepo.
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

Invalidating Queries
himHhim / ❓-help
3mo ago
NextJs Setup: `useContext is not a function`
webWweb / ❓-help
2y ago