@@ -1088,19 +1088,17 @@ async function completeAsyncIteratorValue(
10881088 /* c8 ignore start */
10891089 if ( isPromise ( item ) ) {
10901090 completedResults . push (
1091- completePromisedValue (
1091+ completePromisedListItemValue (
1092+ item ,
1093+ acc ,
10921094 exeContext ,
10931095 itemType ,
10941096 fieldGroup ,
10951097 info ,
10961098 itemPath ,
1097- item ,
10981099 incrementalContext ,
10991100 deferMap ,
1100- ) . then ( ( resolved ) => {
1101- appendNewIncrementalDataRecords ( acc , resolved [ 1 ] ) ;
1102- return resolved [ 0 ] ;
1103- } ) ,
1101+ ) ,
11041102 ) ;
11051103 containsPromise = true ;
11061104 } else if (
@@ -1217,19 +1215,17 @@ function completeListValue(
12171215
12181216 if ( isPromise ( item ) ) {
12191217 completedResults . push (
1220- completePromisedValue (
1218+ completePromisedListItemValue (
1219+ item ,
1220+ acc ,
12211221 exeContext ,
12221222 itemType ,
12231223 fieldGroup ,
12241224 info ,
12251225 itemPath ,
1226- item ,
12271226 incrementalContext ,
12281227 deferMap ,
1229- ) . then ( ( resolved ) => {
1230- appendNewIncrementalDataRecords ( acc , resolved [ 1 ] ) ;
1231- return resolved [ 0 ] ;
1232- } ) ,
1228+ ) ,
12331229 ) ;
12341230 containsPromise = true ;
12351231 } else if (
@@ -1328,6 +1324,47 @@ function completeListItemValue(
13281324 return false ;
13291325}
13301326
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+
13311368/**
13321369 * Complete a Scalar or Enum by serializing to a valid value, returning
13331370 * null if serialization is not possible.
0 commit comments