Skip to content

Commit

Permalink
use batchLoadFn.apply instead of directly invoking batchLoadFn
Browse files Browse the repository at this point in the history
use batchLoadFn.apply(loader,[keys]) instead of batchLoadFn(keys) to allow acces to the actual dataloader. Needed for example to use dataloader.prime() in the batch loader function.
  • Loading branch information
jorisroling authored and leebyron committed Nov 13, 2019
1 parent cffec0e commit eac61e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -253,7 +253,7 @@ function dispatchQueueBatch<K, V>(

// Call the provided batchLoadFn for this loader with the loader queue's keys.
var batchLoadFn = loader._batchLoadFn;
var batchPromise = batchLoadFn(keys);
var batchPromise = batchLoadFn.apply(loader, [ keys ]);

// Assert the expected response from batchLoadFn
if (!batchPromise || typeof batchPromise.then !== 'function') {
Expand Down

0 comments on commit eac61e6

Please sign in to comment.