Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/execution/collectFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ import { typeFromAST } from '../utilities/typeFromAST.js';

import { getDirectiveValues } from './values.js';

export type FieldGroup = ReadonlyArray<FieldNode>;

export type GroupedFieldSet = Map<string, FieldGroup>;

export interface PatchFields {
label: string | undefined;
fields: Map<string, ReadonlyArray<FieldNode>>;
fields: GroupedFieldSet;
}

export interface FieldsAndPatches {
fields: Map<string, ReadonlyArray<FieldNode>>;
fields: GroupedFieldSet;
patches: Array<PatchFields>;
}

Expand Down Expand Up @@ -85,7 +89,7 @@ export function collectSubfields(
variableValues: { [variable: string]: unknown },
operation: OperationDefinitionNode,
returnType: GraphQLObjectType,
fieldNodes: ReadonlyArray<FieldNode>,
fieldGroup: FieldGroup,
): FieldsAndPatches {
const subFieldNodes = new AccumulatorMap<string, FieldNode>();
const visitedFragmentNames = new Set<string>();
Expand All @@ -96,7 +100,7 @@ export function collectSubfields(
patches: subPatches,
};

for (const node of fieldNodes) {
for (const node of fieldGroup) {
if (node.selectionSet) {
collectFieldsImpl(
schema,
Expand Down
Loading