Skip to content

Commit 4c8d190

Browse files
committed
Fix dynamic introspection
1 parent fd1f923 commit 4c8d190

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

lib/graphql/execution/next/field_resolve_step.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,25 +613,26 @@ def build_graphql_result(graphql_result, key, field_result, return_type, is_nn,
613613
end
614614

615615
def resolve_batch(objects, context, args_hash)
616+
method_receiver = @field_definition.dynamic_introspection ? @field_definition.owner : @parent_type
616617
case @field_definition.execution_next_mode
617618
when :resolve_batch
618619
if args_hash.empty?
619-
@parent_type.public_send(@field_definition.execution_next_mode_key, objects, context)
620+
method_receiver.public_send(@field_definition.execution_next_mode_key, objects, context)
620621
else
621-
@parent_type.public_send(@field_definition.execution_next_mode_key, objects, context, **args_hash)
622+
method_receiver.public_send(@field_definition.execution_next_mode_key, objects, context, **args_hash)
622623
end
623624
when :resolve_static
624625
result = if args_hash.empty?
625-
@parent_type.public_send(@field_definition.execution_next_mode_key, context)
626+
method_receiver.public_send(@field_definition.execution_next_mode_key, context)
626627
else
627-
@parent_type.public_send(@field_definition.execution_next_mode_key, context, **args_hash)
628+
method_receiver.public_send(@field_definition.execution_next_mode_key, context, **args_hash)
628629
end
629630
Array.new(objects.size, result)
630631
when :resolve_each
631632
if args_hash.empty?
632-
objects.map { |o| @parent_type.public_send(@field_definition.execution_next_mode_key, o, context) }
633+
objects.map { |o| method_receiver.public_send(@field_definition.execution_next_mode_key, o, context) }
633634
else
634-
objects.map { |o| @parent_type.public_send(@field_definition.execution_next_mode_key, o, context, **args_hash) }
635+
objects.map { |o| method_receiver.public_send(@field_definition.execution_next_mode_key, o, context, **args_hash) }
635636
end
636637
when :hash_key
637638
objects.map { |o| o[@field_definition.execution_next_mode_key] }
@@ -660,7 +661,7 @@ def resolve_batch(objects, context, args_hash)
660661
when :resolve_legacy_instance_method
661662
@selections_step.graphql_objects.map do |obj_inst|
662663
if @field_definition.dynamic_introspection
663-
obj_inst = object_type.wrap(obj_inst, context)
664+
obj_inst = @owner.wrap(obj_inst, context)
664665
end
665666
if args_hash.empty?
666667
obj_inst.public_send(@field_definition.execution_next_mode_key)

0 commit comments

Comments
 (0)