Skip to content

useMutationLoading returns true in onDone hook #1387

@TheDutchCoder

Description

@TheDutchCoder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions