Skip to content
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

Fix errorPolicy on useMutation hook #5863

Merged

Conversation

jamesreggio
Copy link
Contributor

@jamesreggio jamesreggio commented Jan 26, 2020

Hello Apollo folks 👋

The useMutation hook exposes errorPolicy in its option typings, but doesn't pass the value through to the underlying mutate method on the ApolloClient instance.

This seems like an oversight, since there's value in being able to specify errorPolicy: 'all' and have the hook's mutate function resolve (not reject) with an error field.

I've fixed this minor bug and wrote some tests to prevent future regressions.

This fix relates to this issue from the deprecated react-apollo repo: apollographql/react-apollo#3728

@jamesreggio jamesreggio force-pushed the fix-mutation-hook-errorpolicy branch from 62e4cde to f82222d Compare January 26, 2020 18:34
@jamesreggio jamesreggio requested a review from benjamn January 28, 2020 06:19
@Zigonja
Copy link

Zigonja commented Feb 11, 2020

Hello! Is there an ETA as to when will this be merged to master?

Thank you!

@djordjes
Copy link

Same problem here, any update on this?

@jamesreggio
Copy link
Contributor Author

Hey @hwillson, don't mean to be a pain, but do you mind taking a look at this? Multiple people are encountering this issue.

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here @jamesreggio - this looks great! Thanks!

@hwillson hwillson merged commit 379bbb0 into apollographql:master Feb 27, 2020
@Zigonja
Copy link

Zigonja commented Feb 27, 2020

Thanks! This was a much needed fix for my case

@t-lock
Copy link

t-lock commented Mar 5, 2020

@jamesreggio @hwillson does the recent merge here mean that updating apollo-client package will include the fix, or do we need to wait for a release?

@hwillson
Copy link
Member

hwillson commented Mar 7, 2020

@t-lock These changes are now available in @apollo/client@latest.

@jamesreggio jamesreggio deleted the fix-mutation-hook-errorpolicy branch March 24, 2020 03:31
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants