Skip to content

Commit f9f00cd

Browse files
committed
Rename disable_batching attribute to match its semantics
disable_batching was being set to true for the subselection, but that is actually where we do batching on mutations, so enable_batching matches how it is actually being used. Also, I moved the attribute to the mutation execution strategy, since that is the only place it is used.
1 parent f95b10c commit f9f00cd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/graphql/batch/execution_strategy.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module GraphQL::Batch
22
class ExecutionStrategy < GraphQL::Query::SerialExecution
3-
attr_accessor :disable_batching
4-
53
def execute(_, _, query)
64
Promise.sync(as_promise_unless_resolved(super))
75
rescue GraphQL::InvalidNullError => err

lib/graphql/batch/mutation_execution_strategy.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
module GraphQL::Batch
22
class MutationExecutionStrategy < GraphQL::Batch::ExecutionStrategy
3+
attr_accessor :enable_batching
4+
35
class FieldResolution < GraphQL::Batch::ExecutionStrategy::FieldResolution
46
def get_finished_value(raw_value)
5-
return super if execution_context.strategy.disable_batching
7+
return super if execution_context.strategy.enable_batching
68

79
raw_value = Promise.sync(raw_value)
810

9-
execution_context.strategy.disable_batching = true
11+
execution_context.strategy.enable_batching = true
1012
begin
1113
result = super(raw_value)
1214
GraphQL::Batch::Executor.current.wait_all
1315
result
1416
ensure
15-
execution_context.strategy.disable_batching = false
17+
execution_context.strategy.enable_batching = false
1618
end
1719
end
1820
end

0 commit comments

Comments
 (0)