The GraphQL Foundation has an official DataLoader package that is well-maintained and more feature complete than what we've built so far.
Instructor: [0:00] We've now built a functional DataLoader step by step showing exactly why each step is needed. This API is very close to the official DataLoader package maintained by the GraphQL Foundation, or we can install with npm install --save DataLoader. Import the DataLoader package, const DataLoader = require('dataloader').
[0:25] Then we can delete the big class we've been writing. The API matches up perfectly, so we'll already be using this DataLoader package for our userLoader. If you hover over, you can see the type signature is being pulled from the package, which we did not write ourselves. That's going to be SELECT ALL FROM users WHERE ID IN (IDs).
[0:51] We have one request for posts and one request for all of the users at once.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!