lib/graphql/execution/execute.rb in graphql-1.8.14 vs lib/graphql/execution/execute.rb in graphql-1.8.15

- old
+ new

@@ -262,23 +262,25 @@ field_type, field_ctx ) when GraphQL::TypeKinds::UNION, GraphQL::TypeKinds::INTERFACE query = field_ctx.query - resolved_type = field_type.resolve_type(value, field_ctx) - possible_types = query.possible_types(field_type) + resolved_type_or_lazy = field_type.resolve_type(value, field_ctx) + query.schema.after_lazy(resolved_type_or_lazy) do |resolved_type| + possible_types = query.possible_types(field_type) - if !possible_types.include?(resolved_type) - parent_type = field_ctx.irep_node.owner_type - type_error = GraphQL::UnresolvedTypeError.new(value, field_defn, parent_type, resolved_type, possible_types) - field_ctx.schema.type_error(type_error, field_ctx) - PROPAGATE_NULL - else - resolve_value( - value, - resolved_type, - field_ctx, - ) + if !possible_types.include?(resolved_type) + parent_type = field_ctx.irep_node.owner_type + type_error = GraphQL::UnresolvedTypeError.new(value, field_defn, parent_type, resolved_type, possible_types) + field_ctx.schema.type_error(type_error, field_ctx) + PROPAGATE_NULL + else + resolve_value( + value, + resolved_type, + field_ctx, + ) + end end else raise("Unknown type kind: #{field_type.kind}") end end