Skip to content

Commit

Permalink
Allow others to trace execute_field GQL event
Browse files Browse the repository at this point in the history
The new tracing API works in a way that modules get included into a
`GraphQL::Tracing::Trace` class, which provides a no-op `#execute_field`
implementation that just yields. If we don't call `super`, other tracing
modules that override `#execute_field` as well, that got included before
batch-loader, won't get executed, because `yield` will short-circuit the
execution.
  • Loading branch information
janko committed Apr 2, 2024
1 parent f066e66 commit 30d5816
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/batch_loader/graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class BatchLoader
class GraphQL
module Trace
def execute_field(**_data)
result = yield
result = super
result.respond_to?(:__sync) ? BatchLoader::GraphQL.wrap_with_warning(result) : result
end
end
Expand Down

0 comments on commit 30d5816

Please sign in to comment.