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.
Answered by
stephenasuncionDEV
Sep 6, 2023
Replies: 2 comments 3 replies
-
Fixed: Another context was conflicting with TRPC because both use react-query. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
stephenasuncionDEV
-
Now this useContext seems to be deprecated how do you perform invalidation in trpc + nextjs |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed: Another context was conflicting with TRPC because both use react-query.