-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Enable atomic nested mutations #628
Comments
That should be the behavior. GraphQL states that Having said that, a fail means a GraphQL fail, which could not be the case when using "nice" error returns, such as those: https://strawberry.rocks/docs/django/guide/mutations#django-errors-handling Is that not what you are seeing? If so, could you provide an example? Asking because that would probably be an issue at https://github.com/graphql-python/graphql-core level. |
Thanks, @bellini666. My question is whether we should have a better mechanism to roll back previous actions if one fails. Should we be treating these mutations as an atomic transaction? Right now, during checkout, we execute four or five different mutations (invoicing, payment, shipping, etc.). If one, like shipping, fails, we end up in an incomplete state. This might be acceptable for now, but I’m curious how other GraphQL libraries handle this. The detailed implementation of atomicity is more framework-specific (e.g., Django), so I wonder if it is less something that would be in the core but more framework-specific as well? Or if everyone is creating very specific custom mutations (ie checkout)? Happy to close as "won't do" was just more curious about what the Django approach is? |
@keithhackbarth hrm I see what you mean... From the top of my head, I would say that this could be achieved by using extensions, more specifically the It can check if the operation is a mutation, and if it is, it starts a migration in it. Not sure if we could do anything on the django integration side to facilitate that. We should try to check how other frameworks do that (if they do) to get some ideas :) |
Strawberry supports serialization for nested mutations but Strawberry-Django doesn't seem to be able do it in an atomic way
Feature Request Type
Description
In the below example, I expect these things to happen in an atomic way so that if a credit card charge fails we do have to go back out previous transactions.
I've seen similar offers from other libraries such as Prisma.
Upvote & Fund
The text was updated successfully, but these errors were encountered: