Skip to content

v4: Fix useMutation "mutate" optional arguments #893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2020

Conversation

bbugh
Copy link
Contributor

@bbugh bbugh commented Dec 19, 2019

This fixes a type error in useMutation's exported mutate function that required arguments to be specified, even though the intention was that they are optional.

(This appears to have been caused by a typo - the first argument of mutate had a default value, but the second one didn't. I'm surprised that TypeScript didn't catch this.)

const { mutate } = useMutation(...)

// ❌ v4-alpha4: Expected 2 arguments, but got 0
// ✅ works after this PR
mutate()

This PR resolves one of several issues found while creating a graphql-code-generator plugin for vue-apollo hooks, which can be tracked here.

@bbugh bbugh changed the title Fix useMutation "mutate" optional arguments v4: Fix useMutation "mutate" optional arguments Dec 19, 2019
@Akryum Akryum merged commit 9d64fca into vuejs:v4 Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants