Open hardfire opened 7 years ago
When I built this, I was meaning to squeeze dataloader (https://github.com/facebook/dataloader) in to avoid situation. I would suggest playing with it.
First try solving the problem without graphql-bookshelf, then once you have solved it, you can think of ideas on how to bring it in.
This makes total sense. I have already started using dataloader in my application. Right now alongside graphql-bookshelf. It would be interesting to see if we can hook dataloader into graphql-bookshelf to work automagically. Thanks for the response. I will close this issue now.
I'm happy to leave this open until someone takes a shot at integrating this.
I have created a small example where the model is like the following
Now, when I load the following (note: viewer is the student) the there is one query for the student, one for the homework, but multiple for the pages. There are as many queries as there are pages. How can i optimize it so that there is only one query for the all the pages.
Best case scenario would be to load the whole thing at once, but i'd be happy for any pointers on how to optimize this.
The code i used to test this is available at https://gist.github.com/hardfire/3ff69d3a602bf3c30dcbbca71d67d605