Skip to content

Commit 161e6e4

Browse files
committed
Use a similar hack to only wrap objects once
1 parent 733fc28 commit 161e6e4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/graphql/query/context.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ def initialize(context:, key:, irep_node:, parent:, object:)
209209
@tracers = @query.tracers
210210
# This hack flag is required by ConnectionResolve
211211
@wrapped_connection = false
212+
@wrapped_object = false
212213
end
213214

214-
attr_accessor :wrapped_connection
215+
# @api private
216+
attr_accessor :wrapped_connection, :wrapped_object
215217

216218
def path
217219
@path ||= @parent.path.dup << @key

lib/graphql/schema/member/instrumentation.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ def initialize(inner_resolve:, list_depth:, inner_return_type:)
7272

7373
def call(obj, args, ctx)
7474
result = @inner_resolve.call(obj, args, ctx)
75-
if ctx.skip == result || ctx.schema.lazy?(result) || result.nil? || result.is_a?(GraphQL::ExecutionError)
75+
if ctx.skip == result || ctx.schema.lazy?(result) || result.nil? || result.is_a?(GraphQL::ExecutionError) || ctx.wrapped_object
7676
result
7777
else
78+
ctx.wrapped_object = true
7879
proxy_to_depth(result, @list_depth, ctx)
7980
end
8081
rescue GraphQL::UnauthorizedError => err

0 commit comments

Comments
 (0)