TRPC's useContext does not invalidate query. #4780
-
Still dont know why I can confirm that onSuccess gets called. It also doesnt work even if I remove the enabled option. It invalidates when I put an override on const utils = trpc.useContext();
const websites = trpc.website.getWebsites.useQuery(undefined, {
enabled: isAuthenticated,
});
const updateWebsite = trpc.website.updateWebsite.useMutation({
onSuccess: async () => {
await utils.website.getWebsites.invalidate();
},
}); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Fixed: Another context was conflicting with TRPC because both use react-query. |
Beta Was this translation helpful? Give feedback.
-
Now this useContext seems to be deprecated how do you perform invalidation in trpc + nextjs |
Beta Was this translation helpful? Give feedback.
Fixed: Another context was conflicting with TRPC because both use react-query.