apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Invoking "useMutation" with onDone hook does not decrement global mutation loading

Open tsiotska opened this issue 2 years ago • 2 comments

Describe the bug Invoking "useMutation" with onDone hook does not decrement global mutation loading (useGlobalMutationLoading) Will investigate and provide more details or fix soon

workaround use ".then()" or update function

Versions vue: 3.2.41 vue/apollo-composable: 4.0.0-beta.1 @apollo/client: 3.7.14

tsiotska avatar Jun 20 '23 10:06 tsiotska

Update: error was caused because in onDone hook body i destroyed component that used mutation (closed modal window), thus i lost global loading tracking. But shouldn't "onDone" be invoked after loading and mutation are finished?

tsiotska avatar Jun 21 '23 10:06 tsiotska

I also ran into this issue.

I know it´s not beautiful, but it does the trick.

import { nextTick } from 'vue'

.....

onDone(async () => {
  await nextTick()
   .......
})

PR #1559 should fix this

mobsean avatar Jun 06 '24 13:06 mobsean