-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Right now, we assume that resources look something like this:
function getFoo({ count, type, somethingElse }, fetch, options) {
...
i.e. we assume that the underlying resource takes its actual data arguments in the first parameter as an object. The rest are meta arguments which have defaults, and we never really care about overriding them from inside a resolver method.
In this world, a dataloader interface would look like this:
getFoo.load({ count: 4, type: 'baz', somethingElse: 'qux' });
This fits nicely with the interface of dataloader anyway (you can only send one argument as a key)
This assumption has been made because that's the interface of the underlying resources Yelp currently uses. But this might not always be true!
Proposed New Functionality
We should add an option - something like "useAllArguments" so if you wanted to override fetch
from a resolver method, your dataloader interface would look like this:
getFoo.load([{ count: 4, type: 'baz', somethingElse: 'qux' }, myCustomFetch]);
What's the workaround in the meantime
You can use resource middleware to transform the thing that actually gets send to the underlying resource for now, to add extra arguments