@@ -981,6 +981,9 @@ def complete_object_value(
981981 result : Any ,
982982 ) -> AwaitableOrValue [Dict [str , Any ]]:
983983 """Complete an Object value by executing all sub-selections."""
984+ # Collect sub-fields to execute to complete this value.
985+ sub_field_nodes = self .collect_subfields (return_type , field_nodes )
986+
984987 # If there is an `is_type_of()` predicate function, call it with the current
985988 # result. If `is_type_of()` returns False, then raise an error rather than
986989 # continuing execution.
@@ -989,33 +992,20 @@ def complete_object_value(
989992
990993 if self .is_awaitable (is_type_of ):
991994
992- async def collect_and_execute_subfields_async () -> Dict [str , Any ]:
995+ async def execute_subfields_async () -> Dict [str , Any ]:
993996 if not await is_type_of : # type: ignore
994997 raise invalid_return_type_error (
995998 return_type , result , field_nodes
996999 )
997- return self .collect_and_execute_subfields (
998- return_type , field_nodes , path , result
1000+ return self .execute_fields (
1001+ return_type , result , path , sub_field_nodes
9991002 ) # type: ignore
10001003
1001- return collect_and_execute_subfields_async ()
1004+ return execute_subfields_async ()
10021005
10031006 if not is_type_of :
10041007 raise invalid_return_type_error (return_type , result , field_nodes )
10051008
1006- return self .collect_and_execute_subfields (
1007- return_type , field_nodes , path , result
1008- )
1009-
1010- def collect_and_execute_subfields (
1011- self ,
1012- return_type : GraphQLObjectType ,
1013- field_nodes : List [FieldNode ],
1014- path : Path ,
1015- result : Any ,
1016- ) -> AwaitableOrValue [Dict [str , Any ]]:
1017- """Collect sub-fields to execute to complete this value."""
1018- sub_field_nodes = self .collect_subfields (return_type , field_nodes )
10191009 return self .execute_fields (return_type , result , path , sub_field_nodes )
10201010
10211011 def collect_subfields (
0 commit comments