Skip to content

Commit dfb858d

Browse files
committed
Reuse instance of ResultPath
1 parent d6a62a3 commit dfb858d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/main/java/graphql/execution/ExecutionStepInfoFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ public ExecutionStepInfo newExecutionStepInfoForSubField(ExecutionContext execut
4343
.arguments(argumentValues));
4444
}
4545

46-
public ExecutionStepInfo newExecutionStepInfoForListElement(ExecutionStepInfo executionInfo, int index) {
46+
public ExecutionStepInfo newExecutionStepInfoForListElement(ExecutionStepInfo executionInfo, ResultPath indexedPath) {
4747
GraphQLList fieldType = (GraphQLList) executionInfo.getUnwrappedNonNullType();
4848
GraphQLOutputType typeInList = (GraphQLOutputType) fieldType.getWrappedType();
49-
ResultPath indexedPath = executionInfo.getPath().segment(index);
5049
return executionInfo.transform(builder -> builder
5150
.parentInfo(executionInfo)
5251
.type(typeInList)

src/main/java/graphql/execution/ExecutionStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ protected FieldValueInfo completeValueForList(ExecutionContext executionContext,
569569
for (Object item : iterableValues) {
570570
ResultPath indexedPath = parameters.getPath().segment(index);
571571

572-
ExecutionStepInfo stepInfoForListElement = executionStepInfoFactory.newExecutionStepInfoForListElement(executionStepInfo, index);
572+
ExecutionStepInfo stepInfoForListElement = executionStepInfoFactory.newExecutionStepInfoForListElement(executionStepInfo, indexedPath);
573573

574574
NonNullableFieldValidator nonNullableFieldValidator = new NonNullableFieldValidator(executionContext, stepInfoForListElement);
575575

0 commit comments

Comments
 (0)