I find dataloaders usefull for avoiding fetching d...
# graphql-kotlin
b
I find dataloaders usefull for avoiding fetching duplicate data. in that excample above, each invovation to the load function with an id will run the code behind the service. If you use a data loader only unique keys are sent to the underlying dataloader and distributed to the correct dispatchers. For some simple scenarios it might not matter, but lets say you have 1000 Employees with 2 different companies. Then it is a lot better to just load the two companies once each. You might be able to do the same if you cache the results from that manual service though. Another nice aspect of dataloaders is that you can provide a version that resolves all the keys in a single call. So lets say you have a service that can return a list of companies. Then you can just send it all the keys and it will load them all in a single call.