Skip to content
Merged
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
10 changes: 2 additions & 8 deletions src/execution/collectFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {
FragmentDefinitionNode,
FragmentSpreadNode,
InlineFragmentNode,
OperationDefinitionNode,
SelectionSetNode,
} from '../language/ast.js';
import { Kind } from '../language/kinds.js';
Expand Down Expand Up @@ -70,7 +69,7 @@ export function collectFields(
fragments: ObjMap<FragmentDetails>,
variableValues: VariableValues,
runtimeType: GraphQLObjectType,
operation: OperationDefinitionNode,
selectionSet: SelectionSetNode,
hideSuggestions: boolean,
): {
groupedFieldSet: GroupedFieldSet;
Expand All @@ -87,12 +86,7 @@ export function collectFields(
hideSuggestions,
};

collectFieldsImpl(
context,
operation.selectionSet,
groupedFieldSet,
newDeferUsages,
);
collectFieldsImpl(context, selectionSet, groupedFieldSet, newDeferUsages);
return { groupedFieldSet, newDeferUsages };
}

Expand Down
10 changes: 6 additions & 4 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,12 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
hideSuggestions,
} = validatedExecutionArgs;

const rootType = schema.getRootType(operation.operation);
const { operation: operationType, selectionSet } = operation;

const rootType = schema.getRootType(operationType);
if (rootType == null) {
throw new GraphQLError(
`Schema is not configured to execute ${operation.operation} operation.`,
`Schema is not configured to execute ${operationType} operation.`,
{ nodes: operation },
);
}
Expand All @@ -350,7 +352,7 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
fragments,
variableValues,
rootType,
operation,
selectionSet,
hideSuggestions,
);

Expand Down Expand Up @@ -2244,7 +2246,7 @@ function executeSubscription(
fragments,
variableValues,
rootType,
operation,
operation.selectionSet,
hideSuggestions,
);

Expand Down
2 changes: 1 addition & 1 deletion src/validation/rules/SingleFieldSubscriptionsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function SingleFieldSubscriptionsRule(
fragments,
variableValues,
subscriptionType,
node,
node.selectionSet,
context.hideSuggestions,
);
if (groupedFieldSet.size > 1) {
Expand Down
Loading