Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useMutationLoading returns true in onDone hook #1387

Open
TheDutchCoder opened this issue Jul 22, 2022 · 1 comment
Open

useMutationLoading returns true in onDone hook #1387

TheDutchCoder opened this issue Jul 22, 2022 · 1 comment

Comments

@TheDutchCoder
Copy link

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 TheDutchCoder changed the title useMutationLoading returns true in onDone hook useMutationLoading returns true in onDone hook Jul 22, 2022
@tiagosilvaalopes
Copy link

I have the same issue but with useQueryLoading()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants