lib/batch_loader/graphql.rb in batch-loader-1.0.2 vs lib/batch_loader/graphql.rb in batch-loader-1.0.3

- old
+ new

@@ -6,11 +6,11 @@ def initialize(batch_loader) @batch_loader = batch_loader end def sync - @batch_loader + @batch_loader.__sync end end def self.use(schema_definition) schema_definition.lazy_resolve(BatchLoader::GraphQL::Wrapper, :sync) @@ -19,10 +19,10 @@ def self.instrument(type, field) old_resolve_proc = field.resolve_proc new_resolve_proc = ->(object, arguments, context) do result = old_resolve_proc.call(object, arguments, context) - result.respond_to?(:batch_loader?) ? BatchLoader::GraphQL::Wrapper.new(result) : result + result.respond_to?(:__sync) ? BatchLoader::GraphQL::Wrapper.new(result) : result end field.redefine { resolve(new_resolve_proc) } end end