Sha256: 9aaa4f73b756c0d67e64d650bf3fef21dcf771c65e013df7f8f3abf67916e678

Contents?: true

Size: 684 Bytes

Versions: 4

Compression:

Stored size: 684 Bytes

Contents

require_relative "execution_strategy"

module GraphQL::Batch
  class MutationExecutionStrategy < GraphQL::Batch::ExecutionStrategy
    attr_accessor :enable_batching

    class FieldResolution < GraphQL::Batch::ExecutionStrategy::FieldResolution
      def get_finished_value(raw_value)
        strategy = execution_context.strategy
        return super if strategy.enable_batching

        GraphQL::Batch::Executor.current.clear
        begin
          strategy.enable_batching = true
          strategy.deep_sync(::Promise.sync(super))
        ensure
          strategy.enable_batching = false
          GraphQL::Batch::Executor.current.clear
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-batch-0.3.10 lib/graphql/batch/mutation_execution_strategy.rb
graphql-batch-0.3.9 lib/graphql/batch/mutation_execution_strategy.rb
graphql-batch-0.3.8 lib/graphql/batch/mutation_execution_strategy.rb
graphql-batch-0.3.7 lib/graphql/batch/mutation_execution_strategy.rb