@@ -1108,19 +1108,17 @@ async function completeAsyncIteratorValue(
1108
1108
/* c8 ignore start */
1109
1109
if ( isPromise ( item ) ) {
1110
1110
completedResults . push (
1111
- completePromisedValue (
1111
+ completePromisedListItemValue (
1112
+ item ,
1113
+ acc ,
1112
1114
exeContext ,
1113
1115
itemType ,
1114
1116
fieldGroup ,
1115
1117
info ,
1116
1118
itemPath ,
1117
- item ,
1118
1119
incrementalContext ,
1119
1120
deferMap ,
1120
- ) . then ( ( resolved ) => {
1121
- appendNewIncrementalDataRecords ( acc , resolved [ 1 ] ) ;
1122
- return resolved [ 0 ] ;
1123
- } ) ,
1121
+ ) ,
1124
1122
) ;
1125
1123
containsPromise = true ;
1126
1124
} else if (
@@ -1237,19 +1235,17 @@ function completeListValue(
1237
1235
1238
1236
if ( isPromise ( item ) ) {
1239
1237
completedResults . push (
1240
- completePromisedValue (
1238
+ completePromisedListItemValue (
1239
+ item ,
1240
+ acc ,
1241
1241
exeContext ,
1242
1242
itemType ,
1243
1243
fieldGroup ,
1244
1244
info ,
1245
1245
itemPath ,
1246
- item ,
1247
1246
incrementalContext ,
1248
1247
deferMap ,
1249
- ) . then ( ( resolved ) => {
1250
- appendNewIncrementalDataRecords ( acc , resolved [ 1 ] ) ;
1251
- return resolved [ 0 ] ;
1252
- } ) ,
1248
+ ) ,
1253
1249
) ;
1254
1250
containsPromise = true ;
1255
1251
} else if (
@@ -1348,6 +1344,47 @@ function completeListItemValue(
1348
1344
return false ;
1349
1345
}
1350
1346
1347
+ async function completePromisedListItemValue (
1348
+ item : unknown ,
1349
+ parent : GraphQLResult < Array < unknown > > ,
1350
+ exeContext : ExecutionContext ,
1351
+ itemType : GraphQLOutputType ,
1352
+ fieldGroup : FieldGroup ,
1353
+ info : GraphQLResolveInfo ,
1354
+ itemPath : Path ,
1355
+ incrementalContext : IncrementalContext | undefined ,
1356
+ deferMap : ReadonlyMap < DeferUsage , DeferredFragmentRecord > | undefined ,
1357
+ ) : Promise < unknown > {
1358
+ try {
1359
+ const resolved = await item ;
1360
+ let completed = completeValue (
1361
+ exeContext ,
1362
+ itemType ,
1363
+ fieldGroup ,
1364
+ info ,
1365
+ itemPath ,
1366
+ resolved ,
1367
+ incrementalContext ,
1368
+ deferMap ,
1369
+ ) ;
1370
+ if ( isPromise ( completed ) ) {
1371
+ completed = await completed ;
1372
+ }
1373
+ appendNewIncrementalDataRecords ( parent , completed [ 1 ] ) ;
1374
+ return completed [ 0 ] ;
1375
+ } catch ( rawError ) {
1376
+ handleFieldError (
1377
+ rawError ,
1378
+ exeContext ,
1379
+ itemType ,
1380
+ fieldGroup ,
1381
+ itemPath ,
1382
+ incrementalContext ,
1383
+ ) ;
1384
+ return null ;
1385
+ }
1386
+ }
1387
+
1351
1388
/**
1352
1389
* Complete a Scalar or Enum by serializing to a valid value, returning
1353
1390
* null if serialization is not possible.
0 commit comments