krislefeber / nestjs-dataloader

Dataloader plugin for NestJS
https://krislefeber.github.io/nestjs-dataloader/
MIT License
148 stars 45 forks source link

Unnecessary function wrap #34

Open WillSquire opened 4 years ago

WillSquire commented 4 years ago

In your examples, I believe this:

return new DataLoader<string, Account>(keys =>
      this.accountService.findByIds(keys)
)

Can be this:

return new DataLoader<string, Account>(this.accountService.findByIds)

If it's helpful.

jeromemeichelbeck commented 3 years ago

Well I guess it's just an exemple.

Also I think the findByIds method doesn't guarantee the order, so we should make extra work to make sure that the we return the instances in the same order of the keys.