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

GraphQl Errors not being thrown in mutate call #5629

Closed
kanishktokopedia opened this issue Nov 28, 2019 · 4 comments
Closed

GraphQl Errors not being thrown in mutate call #5629

kanishktokopedia opened this issue Nov 28, 2019 · 4 comments
Labels
🔍 investigate Investigate further

Comments

@kanishktokopedia
Copy link

kanishktokopedia commented Nov 28, 2019

Intended outcome:
Ideally, when a GraphQL errror comes in mutation it should be thrown.

Actual outcome:
The call to apolloClient.mutate is never resolved.

How to reproduce the issue:
The lines here:

It creates an error but never rejects it as can be seen in the code written above. Although, adding the following line just below the tagged line works:
reject(error)

Versions
2.6.4

@Gallevy
Copy link

Gallevy commented Dec 11, 2019

Same issue, did it get changed recently because i don't remember this behavior being problematic

@willipreuk
Copy link

Currently I have the problem, that an error is thrown. In my opinion it would be better to just populate the error response, returned from useMutation. With this approach the user can easily choose how to handle the error. I mean even the docs are describing it like this.

@jcreighton jcreighton self-assigned this Apr 20, 2021
@brainkim brainkim self-assigned this Jun 22, 2021
@hwillson hwillson added the 🔍 investigate Investigate further label May 31, 2022
@mccraveiro
Copy link
Contributor

@willipreuk yours seems to be another issue. Check #6070

@alessbell
Copy link
Contributor

Hi @kanishktokopedia 👋 v3.x.x was released in mid-2020, and so, while I can't comment on whether this was ever resolved in v2, this seems to be fixed now (here's the relevant test case): https://github.com/apollographql/apollo-client/blob/main/src/react/hooks/__tests__/useMutation.test.tsx#L332:L373

I hope this is helpful, thanks 😊

@alessbell alessbell closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔍 investigate Investigate further
Projects
None yet
Development

No branches or pull requests

8 participants