@@ -1088,19 +1088,17 @@ async function completeAsyncIteratorValue(
1088
1088
/* c8 ignore start */
1089
1089
if ( isPromise ( item ) ) {
1090
1090
completedResults . push (
1091
- completePromisedValue (
1091
+ completePromisedListItemValue (
1092
+ item ,
1093
+ acc ,
1092
1094
exeContext ,
1093
1095
itemType ,
1094
1096
fieldGroup ,
1095
1097
info ,
1096
1098
itemPath ,
1097
- item ,
1098
1099
incrementalContext ,
1099
1100
deferMap ,
1100
- ) . then ( ( resolved ) => {
1101
- appendNewIncrementalDataRecords ( acc , resolved [ 1 ] ) ;
1102
- return resolved [ 0 ] ;
1103
- } ) ,
1101
+ ) ,
1104
1102
) ;
1105
1103
containsPromise = true ;
1106
1104
} else if (
@@ -1217,19 +1215,17 @@ function completeListValue(
1217
1215
1218
1216
if ( isPromise ( item ) ) {
1219
1217
completedResults . push (
1220
- completePromisedValue (
1218
+ completePromisedListItemValue (
1219
+ item ,
1220
+ acc ,
1221
1221
exeContext ,
1222
1222
itemType ,
1223
1223
fieldGroup ,
1224
1224
info ,
1225
1225
itemPath ,
1226
- item ,
1227
1226
incrementalContext ,
1228
1227
deferMap ,
1229
- ) . then ( ( resolved ) => {
1230
- appendNewIncrementalDataRecords ( acc , resolved [ 1 ] ) ;
1231
- return resolved [ 0 ] ;
1232
- } ) ,
1228
+ ) ,
1233
1229
) ;
1234
1230
containsPromise = true ;
1235
1231
} else if (
@@ -1328,6 +1324,47 @@ function completeListItemValue(
1328
1324
return false ;
1329
1325
}
1330
1326
1327
+ async function completePromisedListItemValue (
1328
+ item : unknown ,
1329
+ parent : GraphQLResult < Array < unknown > > ,
1330
+ exeContext : ExecutionContext ,
1331
+ itemType : GraphQLOutputType ,
1332
+ fieldGroup : FieldGroup ,
1333
+ info : GraphQLResolveInfo ,
1334
+ itemPath : Path ,
1335
+ incrementalContext : IncrementalContext | undefined ,
1336
+ deferMap : ReadonlyMap < DeferUsage , DeferredFragmentRecord > | undefined ,
1337
+ ) : Promise < unknown > {
1338
+ try {
1339
+ const resolved = await item ;
1340
+ let completed = completeValue (
1341
+ exeContext ,
1342
+ itemType ,
1343
+ fieldGroup ,
1344
+ info ,
1345
+ itemPath ,
1346
+ resolved ,
1347
+ incrementalContext ,
1348
+ deferMap ,
1349
+ ) ;
1350
+ if ( isPromise ( completed ) ) {
1351
+ completed = await completed ;
1352
+ }
1353
+ appendNewIncrementalDataRecords ( parent , completed [ 1 ] ) ;
1354
+ return completed [ 0 ] ;
1355
+ } catch ( rawError ) {
1356
+ handleFieldError (
1357
+ rawError ,
1358
+ exeContext ,
1359
+ itemType ,
1360
+ fieldGroup ,
1361
+ itemPath ,
1362
+ incrementalContext ,
1363
+ ) ;
1364
+ return null ;
1365
+ }
1366
+ }
1367
+
1331
1368
/**
1332
1369
* Complete a Scalar or Enum by serializing to a valid value, returning
1333
1370
* null if serialization is not possible.
0 commit comments