apollo icon indicating copy to clipboard operation
apollo copied to clipboard

`useMutationLoading` returns `true` in `onDone` hook

Open TheDutchCoder opened this issue 2 years ago • 1 comments

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

TheDutchCoder avatar Jul 22 '22 15:07 TheDutchCoder

I have the same issue but with useQueryLoading()

tiagosilvaalopes avatar Aug 26 '22 14:08 tiagosilvaalopes