Skip to content

Commit 3921587

Browse files
author
Guillaume Chau
committed
feat(useMutation): overrideOptions
1 parent 8f3502f commit 3921587

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/docs/src/api/use-mutation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
## Return
4242

43-
- `mutate`: call the mutation with this function.
43+
- `mutate(variables, overrideOptions)`: call the mutation with this function.
4444

4545
- `loading`: boolean `Ref` tracking the progress of the mutation.
4646

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function useMutation<
3434
// Apollo Client
3535
const { resolveClient } = useApolloClient()
3636

37-
async function mutate (variables: TVariables = null) {
37+
async function mutate (variables: TVariables = null, overrideOptions: Omit<UseMutationOptions, 'variables'>) {
3838
let currentDocument: DocumentNode
3939
if (typeof document === 'function') {
4040
currentDocument = document()
@@ -56,6 +56,7 @@ export function useMutation<
5656
const result = await client.mutate({
5757
mutation: currentDocument,
5858
...currentOptions,
59+
...overrideOptions,
5960
variables: {
6061
...variables || {},
6162
...currentOptions.variables || {},

0 commit comments

Comments
 (0)