@@ -1017,6 +1017,9 @@ function completeObjectValue(
1017
1017
path : Path ,
1018
1018
result : mixed ,
1019
1019
) : PromiseOrValue < ObjMap < mixed >> {
1020
+ // Collect sub-fields to execute to complete this value.
1021
+ const subFieldNodes = collectSubfields ( exeContext , returnType , fieldNodes ) ;
1022
+
1020
1023
// If there is an isTypeOf predicate function, call it with the
1021
1024
// current result. If isTypeOf returns false, then raise an error rather
1022
1025
// than continuing execution.
@@ -1028,12 +1031,12 @@ function completeObjectValue(
1028
1031
if ( ! resolvedIsTypeOf ) {
1029
1032
throw invalidReturnTypeError ( returnType , result , fieldNodes ) ;
1030
1033
}
1031
- return collectAndExecuteSubfields (
1034
+ return executeFields (
1032
1035
exeContext ,
1033
1036
returnType ,
1034
- fieldNodes ,
1035
- path ,
1036
1037
result ,
1038
+ path ,
1039
+ subFieldNodes ,
1037
1040
) ;
1038
1041
} ) ;
1039
1042
}
@@ -1043,13 +1046,7 @@ function completeObjectValue(
1043
1046
}
1044
1047
}
1045
1048
1046
- return collectAndExecuteSubfields (
1047
- exeContext ,
1048
- returnType,
1049
- fieldNodes,
1050
- path,
1051
- result,
1052
- ) ;
1049
+ return executeFields ( exeContext , returnType , result , path , subFieldNodes ) ;
1053
1050
}
1054
1051
1055
1052
function invalidReturnTypeError (
@@ -1063,18 +1060,6 @@ function invalidReturnTypeError(
1063
1060
) ;
1064
1061
}
1065
1062
1066
- function collectAndExecuteSubfields (
1067
- exeContext : ExecutionContext ,
1068
- returnType : GraphQLObjectType ,
1069
- fieldNodes : $ReadOnlyArray < FieldNode > ,
1070
- path : Path ,
1071
- result : mixed ,
1072
- ) : PromiseOrValue < ObjMap < mixed >> {
1073
- // Collect sub-fields to execute to complete this value.
1074
- const subFieldNodes = collectSubfields ( exeContext , returnType , fieldNodes ) ;
1075
- return executeFields ( exeContext , returnType , result , path , subFieldNodes ) ;
1076
- }
1077
-
1078
1063
/**
1079
1064
* A memoized collection of relevant subfields with regard to the return
1080
1065
* type. Memoizing ensures the subfields are not repeatedly calculated, which
0 commit comments