Skip to content

Run multiple mutations in one request #119

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

Closed
Felix-N opened this issue Jul 20, 2020 · 6 comments
Closed

Run multiple mutations in one request #119

Felix-N opened this issue Jul 20, 2020 · 6 comments
Labels
type: question or discussion Issue discussing or asking a question about gql

Comments

@Felix-N
Copy link

Felix-N commented Jul 20, 2020

Hi,

how do you run multiple mutations in one request?

I've found the option to pass an operation_name into execute, but that only executes that one operation.

@KingDarBoja KingDarBoja added the type: question or discussion Issue discussing or asking a question about gql label Jul 30, 2020
@leszekhanusz
Copy link
Collaborator

You can put multiple operations in a single mutation, there is no need to specify an operation_name.
See multiple mutations on hasura for example

@gyscos
Copy link

gyscos commented Aug 19, 2020

The problem is that currently, if any field from the mutation fails, then an exception is still raised. Other mutations may have succeeded, and a data field may be present in the response, but it will be ignored.
In addition in the v2 branch only the first error is returned (though that's fixed in the yet-unreleased master branch).

(The same applies to Queries, it's not specific to mutations.)

A solution may be to include data in the returned exception, so users can decide to check it for whatever worked.

@leszekhanusz
Copy link
Collaborator

A solution may be to include data in the returned exception, so users can decide to check it for whatever worked.

That is a good idea!

@leszekhanusz
Copy link
Collaborator

@gyscos is this PR ok for you ?

@gyscos
Copy link

gyscos commented Aug 28, 2020

Looks good to me, thanks!

@leszekhanusz
Copy link
Collaborator

This is now possible in version 3.0.0a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about gql
Projects
None yet
Development

No branches or pull requests

4 participants