@@ -75,7 +75,8 @@ public class ExecutionContext {
7575 private final ResultNodesInfo resultNodesInfo = new ResultNodesInfo ();
7676 private final EngineRunningState engineRunningState ;
7777
78- private final Map <OperationDefinition , ImmutableList <QueryAppliedDirective >> opDirectivesMap ;
78+ private final Map <OperationDefinition , ImmutableList <QueryAppliedDirective >> allOperationsDirectives ;
79+ private final Map <String , ImmutableList <QueryAppliedDirective >> operationDirectives ;
7980 private final Profiler profiler ;
8081
8182 ExecutionContext (ExecutionContextBuilder builder ) {
@@ -105,8 +106,10 @@ public class ExecutionContext {
105106 this .queryTree = FpKit .interThreadMemoize (() -> ExecutableNormalizedOperationFactory .createExecutableNormalizedOperation (graphQLSchema , operationDefinition , fragmentsByName , coercedVariables ));
106107 this .propagateErrorsOnNonNullContractFailure = builder .propagateErrorsOnNonNullContractFailure ;
107108 this .engineRunningState = builder .engineRunningState ;
108- this .opDirectivesMap = builder .opDirectivesMap ;
109109 this .profiler = builder .profiler ;
110+ this .allOperationsDirectives = builder .opDirectivesMap ;
111+ List <QueryAppliedDirective > list = allOperationsDirectives .get (getOperationDefinition ());
112+ this .operationDirectives = OperationDirectivesResolver .toAppliedDirectivesByName (list );
110113 }
111114
112115 public ExecutionId getExecutionId () {
@@ -145,16 +148,15 @@ public OperationDefinition getOperationDefinition() {
145148 * @return the map of {@link QueryAppliedDirective}s by name that were on this executing operation
146149 */
147150 public Map <String , ImmutableList <QueryAppliedDirective >> getOperationDirectives () {
148- List <QueryAppliedDirective > list = opDirectivesMap .get (getOperationDefinition ());
149- return OperationDirectivesResolver .toAppliedDirectivesByName (list );
151+ return operationDirectives ;
150152 }
151153
152154 /**
153155 * @return the map of all the {@link QueryAppliedDirective}s that were on the {@link Document} including
154156 * {@link OperationDefinition}s that are not currently executing.
155157 */
156158 public Map <OperationDefinition , ImmutableList <QueryAppliedDirective >> getAllOperationDirectives () {
157- return opDirectivesMap ;
159+ return allOperationsDirectives ;
158160 }
159161
160162 public CoercedVariables getCoercedVariables () {
0 commit comments