Skip to content

Commit

Permalink
feat(useMutation): overrideOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Dec 4, 2019
1 parent 8f3502f commit 3921587
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/docs/src/api/use-mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

## Return

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

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

Expand Down
3 changes: 2 additions & 1 deletion packages/vue-apollo-composable/src/useMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useMutation<
// Apollo Client
const { resolveClient } = useApolloClient()

async function mutate (variables: TVariables = null) {
async function mutate (variables: TVariables = null, overrideOptions: Omit<UseMutationOptions, 'variables'>) {
let currentDocument: DocumentNode
if (typeof document === 'function') {
currentDocument = document()
Expand All @@ -56,6 +56,7 @@ export function useMutation<
const result = await client.mutate({
mutation: currentDocument,
...currentOptions,
...overrideOptions,
variables: {
...variables || {},
...currentOptions.variables || {},
Expand Down

0 comments on commit 3921587

Please sign in to comment.