Replies: 1 comment 1 reply
-
This sounds like it shouldn’t happen. Can you reproduce this in a codesandbox please? |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I've done my best to read through the documentation and blog posts so I may have missed something to explain this.
I have a useMutation hook that, if I comment out the onSuccess func in the hook, will update the
status
returned from the mutation in the component to "success" (and therefore updates isSuccess to true). However, if I add functionality into the onSuccess the status never gets set to true and I'm not able to render something I'm wanting in my component when the mutation succeeds.my mutation hook:
const useUpdateItem = () => { return useMutation(agreeToUpdate, { onSuccess: (data) => { // do stuff } }) }
and in my component I'm calling the hook and pulling out isSuccess:
const { isSuccess } = useUpdateItem(); isSuccess && (<SomeComponent />)
If I log
status
in the component it shows "loading" and then "idle", but never "success".Am I not supposed to be using isSuccess in my component if I use onSuccess in the mutation?
Apologies if this has already been asked, I did try to find any existing similar questions.
Beta Was this translation helpful? Give feedback.
All reactions