Skip to content

Commit f0ab708

Browse files
authored
fix: useMutations onDone Event hook gets triggered too early (#1559)
1 parent d1098be commit f0ab708

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vue-apollo-composable/src/useMutation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DocumentNode } from 'graphql'
22
import { MutationOptions, OperationVariables, FetchResult, TypedDocumentNode, ApolloError, ApolloClient } from '@apollo/client/core/index.js'
3-
import { ref, onScopeDispose, isRef, Ref, getCurrentScope, shallowRef } from 'vue-demi'
3+
import { ref, onScopeDispose, isRef, Ref, getCurrentScope, shallowRef, nextTick } from 'vue-demi'
44
import { useApolloClient } from './useApolloClient'
55
import { ReactiveFunction } from './util/ReactiveFunction'
66
import { useEventHook } from './util/useEventHook'
@@ -100,6 +100,7 @@ export function useMutation<
100100
: undefined,
101101
})
102102
loading.value = false
103+
await nextTick()
103104
doneEvent.trigger(result, {
104105
client,
105106
})

0 commit comments

Comments
 (0)