useMutation on Success queryClient.invalidate fix #8410
              
                Unanswered
              
          
                  
                    
                      shelllbyyyyyy
                    
                  
                
                  asked this question in
                Show and tell
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
For those who face the problem refetch on useMutation
just setTimeout on it, and voila it works like a charms 👌👌👌
const { mutateAsync: profileMutate, isPending } = useCreateProfileMutation({
onSuccess: () => {
return setTimeout(() => {
queryClient.invalidateQueries({
queryKey: ["fetchProfile"],
});
}, 1000);
},
});
set timer as you like
Beta Was this translation helpful? Give feedback.
All reactions