Sha256: 08ed1cd2a8b424fa013072e3a4f9ce2bb416a6f52ef0407cf9fa8d7b0f33edc0

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 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

1 entries across 1 versions & 1 rubygems

Version Path
graphql-batch-0.3.5 lib/graphql/batch/mutation_execution_strategy.rb