apollo
apollo copied to clipboard
`useMutationLoading` returns `true` in `onDone` hook
Describe the bug
When using useMutationLoading
to check wether or not the mutation is still in a "loading" state, the ref returns true
in the onDone hook of that mutation.
Example:
const loading = useMutationLoading()
const { mutate, onDone } = useMutation(SOME_MUTATION)
const doThing = async() => mutate({ input: { id: '1', state: 'waiting' } })
onDone(() => {
console.log(loading.value) // returns true, but should be false, since the mutation is already done.
})
doThing()
To Reproduce Steps to reproduce the behavior: See above example
Expected behavior
useMutationLoading
to return false in the onDone
hook.
Versions vue: 3.2.36 vue-apollo: 4.0.0-alpha.16 @apollo/client: 3.5.10
I have the same issue but with useQueryLoading()