Does the dataloader need to be constructed for every request?
nii236 opened this issue · comments
John Nguyen commented
I noticed that a lot of examples seem to construct new instances in the handlers. I would prefer to create my dataloaders while initialising the server.
This way I can avoid using context.
Can this be done? Can I embed a single instance of the dataloaders into the resolver struct to be reused across requests or does it need to be created every time? Will it keep track of what requests requested which IDs?
John Nguyen commented
After some time with the library, I believe the answer is yes. Dataloader needs a new instance so that you can give it a specific context for that request.