-
Notifications
You must be signed in to change notification settings - Fork 308
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
Support for query batching #13
Comments
I remember @RomanGotsiy to bring up a similar idea. Let's discuss this here to see whether it should be part of |
I'd be really interested to find out what's recommended here. My current scenario is hitting a third party API in a Lambda, retrieving multiple resources, and then wanting to use a batched mutation to create several records in graphcool with Right now, I'm using string interpolation with template literals to build my request. I see that the Apollo team don't recommend that. Is there a better way to do this, passing an array of request objects to |
Yes, this sounds like a very common scenario. I'm getting more and more convinced that query batching should be part of |
I needed to extend graphql-request myself and ported it into its own library: https://github.com/Preposterous/graphql-batching-helpers It gets the job done but could definitely be more feature-rich |
I'd also love to have batching support! |
@schickling Is this going to be a part of 2.0? I can help with the feature if needed, this would be a huge win. |
@schickling I'd still be willing to submit a PR for this feature if someone is willing to review it. |
@darren128 I'll help review, I'm not an official contributor, but the feature would be great and I'm sure we'd all appreciate a PR for this :) |
@pyramation Sounds good, I'll put something together then. |
this feature will be very useful |
The GraphQL spec already allows in theory sending whole graphql documents with multiple operations therein. It should be relatively simple to make the client able to incrementally define a document to send. PRs welcome. |
Some GraphQL servers, such as Graphcool, allow the client to batch multiple queries/mutations into one HTTP request by sending an array of GraphQL request objects (
{ query, variables }
) in the request body.Given the current implementation I can see two ways of doing this:
I'd be interested to see how error handling would work for batch requests - would an error be thrown for the whole batch request if any one of its child queries/mutations returned an error?
The text was updated successfully, but these errors were encountered: