Batch multiple client query



I have list of object { repoName, repoOwner} from which i would like to get the open issues. Thus, i run multiple client.query to get each repo’s open issues. Is there any way to batch requests that happen within 10 ms?

I tried BatchLinkHttp in Apollo Client, when i do network inspect, it seems to work (only send 1 request) but it seems to return 400 bad request. I dont think my credentials is incorrect since it works if without using batchlinkhttp.

I am also not sure how to combine the query directly since the length of the list (number of repositories) i would like to get from is not known till runtime. Is it possible?

Thanks in advance.


Hi @fiennyangeln,

I can’t really answer your questions about batching via GraphQL clients, I haven’t used Apollo Client yet!

This type of GraphQL query should accomplish what you’re looking for:

  a: repository(owner:"d12", name:"test"){ ...OpenIssues }
  b: repository(owner:"d12", name:"graphql-ruby"){ ...OpenIssues }

fragment OpenIssues on Repository{
  issues(first: 100, states: [OPEN]){

The labels a, b, etc will prevent name conflicts with the repository fields. You could also use name+owner there or something.

If you’re having trouble putting something like that together in Apollo, you might have better luck asking your question in an Apollo forum :confused:

Hope this helps!


Thanks a lot! :smiley: