@graphql-tools/batch-execute 8.5.21 → 8.5.22-alpha-20230426144555-13369bbb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,6 +18,11 @@ function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer =
|
|
|
18
18
|
exports.createBatchingExecutor = createBatchingExecutor;
|
|
19
19
|
function createLoadFn(executor, extensionsReducer) {
|
|
20
20
|
return function batchExecuteLoadFn(requests) {
|
|
21
|
+
if (requests.length === 1) {
|
|
22
|
+
return new value_or_promise_1.ValueOrPromise(() => executor(requests[0]))
|
|
23
|
+
.then((result) => [result])
|
|
24
|
+
.catch((err) => [err]);
|
|
25
|
+
}
|
|
21
26
|
const execBatches = [];
|
|
22
27
|
let index = 0;
|
|
23
28
|
const request = requests[index];
|
|
@@ -13,6 +13,11 @@ export function createBatchingExecutor(executor, dataLoaderOptions, extensionsRe
|
|
|
13
13
|
}
|
|
14
14
|
function createLoadFn(executor, extensionsReducer) {
|
|
15
15
|
return function batchExecuteLoadFn(requests) {
|
|
16
|
+
if (requests.length === 1) {
|
|
17
|
+
return new ValueOrPromise(() => executor(requests[0]))
|
|
18
|
+
.then((result) => [result])
|
|
19
|
+
.catch((err) => [err]);
|
|
20
|
+
}
|
|
16
21
|
const execBatches = [];
|
|
17
22
|
let index = 0;
|
|
18
23
|
const request = requests[index];
|
package/package.json
CHANGED