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

Mutations with named resolvers #851

Open
sfwc opened this issue Nov 30, 2023 · 3 comments
Open

Mutations with named resolvers #851

sfwc opened this issue Nov 30, 2023 · 3 comments

Comments

@sfwc
Copy link

sfwc commented Nov 30, 2023

What's currently preventing support for using named resolvers with mutations?

I have a production use case for them and would work on a PR, but want to make sure I'm not barking up the wrong trees.

@nalchevanidze
Copy link
Member

i implemented named resolvers to support batching for optimizing queries.
can you describe how named mutations would work? and you are welcome to make PR however we would then have to make sure that we accidentally do not introduce some dangerous side effects (at least we should disable batching for that).

@sfwc
Copy link
Author

sfwc commented Apr 15, 2024

A mutation can return any of the same data as a query, so I was surprised to find that they weren't handled the same. (Perhaps some users of GraphQL don't commonly return complex data from mutations? But our application involves a Relay frontend, where a mutation will commonly request all the data necessary to update a page.)

Re: side effects, I would think that the only requirement would be to ensure that the mutation itself (the handler for the field of the Mutation object) is evaluated before the handlers for any part of its return value? But maybe I'm overlooking some subtlety.

Happy to hear from you on this! At my work we gave up on using named resolvers after encountering a number of problems with them, and implemented our own somewhat limited batching system instead. If Morpheus is back under active development, maybe we can help resolve some of those issues.

@nalchevanidze
Copy link
Member

@sfwc you can open a pr to improve default batching this could help other developers too :) about mutation i think i should rethink and will answer in more details later

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

No branches or pull requests

2 participants