graphql-compose / graphql-compose/graphql-compose-dataloader

Understanding the plugin use cases

Open
#7 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
18
Forks
6
PR merge metrics
No merged PRs in 30d

Description

After going through the [code](https://github.com/graphql-compose/graphql-compose-dataloader/blob/master/src/index.js) of the plugin it seems that the plugin only works with the default resolvers provided with `graphql-compose` (e.g. `findById` or `findByIds`). Am I correct? So if I'm using a custom resolver the plugin will not help me. I think it will be nice to note this in the readme because users might expect that the plugin automatically provides dataloader functionality for all resolvers (at least this is what I expected).

In addition, on this [line](https://github.com/graphql-compose/graphql-compose-dataloader/blob/518526e1a57d71864f3033f7bdd1d5ad6ce0f5fc/src/composeWithDataLoader.js#L60) for `findByIds` loader I'm wondering why `findByIdResolver.resolve` is called in `resolve(resolveParamsArray.map(rp => findByIdResolver.resolve(rp)))`. Shouldn't `findByIdsResolver` be given an array of id's and called once? Same goes for this [line](https://github.com/graphql-compose/graphql-compose-dataloader/blob/518526e1a57d71864f3033f7bdd1d5ad6ce0f5fc/src/composeWithDataLoader.js#L125) shouldn't `findManyResolver.resolve` be given an array of id's and resolve them in one call? Without this modification as far as I understand the only advantage of using the plugin is that it batches calls to resolvers. But it doesn't group database queries. Am I correct?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.