@@ -396,7 +396,6 @@ def evaluate_selections(owner_object, owner_type, is_eager_selection, gathered_s
396396
397397 # @return [void]
398398 def evaluate_selection ( result_name , field_ast_nodes_or_ast_node , owner_object , owner_type , is_eager_field , selections_result , parent_object ) # rubocop:disable Metrics/ParameterLists
399- return if dead_result? ( selections_result )
400399 # As a performance optimization, the hash key will be a `Node` if
401400 # there's only one selection of the field. But if there are multiple
402401 # selections of the field, it will be an Array of nodes
@@ -429,7 +428,8 @@ def evaluate_selection(result_name, field_ast_nodes_or_ast_node, owner_object, o
429428 # This seems janky, but we need to know
430429 # the field's return type at this path in order
431430 # to propagate `null`
432- if return_type . non_null?
431+ return_type_non_null = return_type . non_null?
432+ if return_type_non_null
433433 ( selections_result . graphql_non_null_field_names ||= [ ] ) . push ( result_name )
434434 end
435435 # Set this before calling `run_with_directives`, so that the directive can have the latest path
@@ -447,19 +447,19 @@ def evaluate_selection(result_name, field_ast_nodes_or_ast_node, owner_object, o
447447 total_args_count = field_defn . arguments ( context ) . size
448448 if total_args_count == 0
449449 resolved_arguments = GraphQL ::Execution ::Interpreter ::Arguments ::EMPTY
450- evaluate_selection_with_args ( resolved_arguments , field_defn , ast_node , field_ast_nodes , owner_type , object , is_eager_field , result_name , selections_result , parent_object , return_type )
450+ evaluate_selection_with_args ( resolved_arguments , field_defn , ast_node , field_ast_nodes , owner_type , object , is_eager_field , result_name , selections_result , parent_object , return_type , return_type_non_null )
451451 else
452452 # TODO remove all arguments(...) usages?
453453 @query . arguments_cache . dataload_for ( ast_node , field_defn , object ) do |resolved_arguments |
454- evaluate_selection_with_args ( resolved_arguments , field_defn , ast_node , field_ast_nodes , owner_type , object , is_eager_field , result_name , selections_result , parent_object , return_type )
454+ evaluate_selection_with_args ( resolved_arguments , field_defn , ast_node , field_ast_nodes , owner_type , object , is_eager_field , result_name , selections_result , parent_object , return_type , return_type_non_null )
455455 end
456456 end
457457 end
458458
459- def evaluate_selection_with_args ( arguments , field_defn , ast_node , field_ast_nodes , owner_type , object , is_eager_field , result_name , selection_result , parent_object , return_type ) # rubocop:disable Metrics/ParameterLists
459+ def evaluate_selection_with_args ( arguments , field_defn , ast_node , field_ast_nodes , owner_type , object , is_eager_field , result_name , selection_result , parent_object , return_type , return_type_non_null ) # rubocop:disable Metrics/ParameterLists
460460 after_lazy ( arguments , owner : owner_type , field : field_defn , ast_node : ast_node , owner_object : object , arguments : arguments , result_name : result_name , result : selection_result ) do |resolved_arguments |
461461 if resolved_arguments . is_a? ( GraphQL ::ExecutionError ) || resolved_arguments . is_a? ( GraphQL ::UnauthorizedError )
462- continue_value ( resolved_arguments , owner_type , field_defn , return_type . non_null? , ast_node , result_name , selection_result )
462+ continue_value ( resolved_arguments , owner_type , field_defn , return_type_non_null , ast_node , result_name , selection_result )
463463 next
464464 end
465465
@@ -813,21 +813,21 @@ def continue_field(value, owner_type, field, current_type, ast_node, next_select
813813 inner_type = current_type . of_type
814814 # This is true for objects, unions, and interfaces
815815 use_dataloader_job = !inner_type . unwrap . kind . input?
816+ inner_type_non_null = inner_type . non_null?
816817 response_list = GraphQLResultArray . new ( result_name , selection_result )
817- response_list . graphql_non_null_list_items = inner_type . non_null?
818+ response_list . graphql_non_null_list_items = inner_type_non_null
818819 set_result ( selection_result , result_name , response_list )
819820 idx = 0
820821 list_value = begin
821822 value . each do |inner_value |
822- break if dead_result? ( response_list )
823823 this_idx = idx
824824 idx += 1
825825 if use_dataloader_job
826826 @dataloader . append_job do
827- resolve_list_item ( inner_value , inner_type , ast_node , field , owner_object , arguments , this_idx , response_list , next_selections , owner_type )
827+ resolve_list_item ( inner_value , inner_type , inner_type_non_null , ast_node , field , owner_object , arguments , this_idx , response_list , next_selections , owner_type )
828828 end
829829 else
830- resolve_list_item ( inner_value , inner_type , ast_node , field , owner_object , arguments , this_idx , response_list , next_selections , owner_type )
830+ resolve_list_item ( inner_value , inner_type , inner_type_non_null , ast_node , field , owner_object , arguments , this_idx , response_list , next_selections , owner_type )
831831 end
832832 end
833833
@@ -857,14 +857,14 @@ def continue_field(value, owner_type, field, current_type, ast_node, next_select
857857 end
858858 end
859859
860- def resolve_list_item ( inner_value , inner_type , ast_node , field , owner_object , arguments , this_idx , response_list , next_selections , owner_type ) # rubocop:disable Metrics/ParameterLists
860+ def resolve_list_item ( inner_value , inner_type , inner_type_non_null , ast_node , field , owner_object , arguments , this_idx , response_list , next_selections , owner_type ) # rubocop:disable Metrics/ParameterLists
861861 st = get_current_runtime_state
862862 st . current_result_name = this_idx
863863 st . current_result = response_list
864864 call_method_on_directives ( :resolve_each , owner_object , ast_node . directives ) do
865865 # This will update `response_list` with the lazy
866866 after_lazy ( inner_value , owner : inner_type , ast_node : ast_node , field : field , owner_object : owner_object , arguments : arguments , result_name : this_idx , result : response_list ) do |inner_inner_value |
867- continue_value = continue_value ( inner_inner_value , owner_type , field , inner_type . non_null? , ast_node , this_idx , response_list )
867+ continue_value = continue_value ( inner_inner_value , owner_type , field , inner_type_non_null , ast_node , this_idx , response_list )
868868 if HALT != continue_value
869869 continue_field ( continue_value , owner_type , field , inner_type , ast_node , next_selections , false , owner_object , arguments , this_idx , response_list )
870870 end
0 commit comments