Skip to content

Commit 5f05205

Browse files
committed
use completePromiseCatchingErrors within completeListItemValue
1 parent e2c3826 commit 5f05205

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

src/execution/__tests__/stream-test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,11 @@ describe('Execute: stream directive', () => {
483483
},
484484
],
485485
},
486+
],
487+
hasNext: true,
488+
},
489+
{
490+
incremental: [
486491
{
487492
items: [{ name: 'Leia', id: '3' }],
488493
path: ['friendList', 2],

src/execution/execute.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,31 +1183,31 @@ function completeListItemValue(
11831183
itemPath: Path,
11841184
asyncPayloadRecord?: AsyncPayloadRecord,
11851185
): boolean {
1186-
try {
1187-
let completedItem;
1188-
if (isPromise(item)) {
1189-
completedItem = item.then((resolved) =>
1190-
completeValue(
1191-
exeContext,
1192-
itemType,
1193-
fieldNodes,
1194-
info,
1195-
itemPath,
1196-
resolved,
1197-
asyncPayloadRecord,
1198-
),
1199-
);
1200-
} else {
1201-
completedItem = completeValue(
1186+
if (isPromise(item)) {
1187+
completedResults.push(
1188+
completePromiseCatchingErrors(
12021189
exeContext,
12031190
itemType,
12041191
fieldNodes,
12051192
info,
12061193
itemPath,
12071194
item,
12081195
asyncPayloadRecord,
1209-
);
1210-
}
1196+
),
1197+
);
1198+
return true;
1199+
}
1200+
1201+
try {
1202+
const completedItem = completeValue(
1203+
exeContext,
1204+
itemType,
1205+
fieldNodes,
1206+
info,
1207+
itemPath,
1208+
item,
1209+
asyncPayloadRecord,
1210+
);
12111211

12121212
if (isPromise(completedItem)) {
12131213
// Note: we don't rely on a `catch` method, but we do expect "thenable"

0 commit comments

Comments
 (0)