Skip to content
Merged
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
16 changes: 7 additions & 9 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
// at which point we still log the error and null the parent field, which
// in this case is the entire response.
try {
const { operation } = exeContext;
const result = executeOperation(exeContext, operation);
const result = executeOperation(exeContext);
if (isPromise(result)) {
return result.then(
(data) => buildResponse(data, exeContext.errors),
Expand Down Expand Up @@ -325,9 +324,10 @@ export function buildExecutionContext(
*/
function executeOperation(
exeContext: ExecutionContext,
operation: OperationDefinitionNode,
): PromiseOrValue<ObjMap<unknown>> {
const rootType = exeContext.schema.getRootType(operation.operation);
const { operation, schema, fragments, variableValues, rootValue } =
exeContext;
const rootType = schema.getRootType(operation.operation);
if (rootType == null) {
throw new GraphQLError(
`Schema is not configured to execute ${operation.operation} operation.`,
Expand All @@ -336,16 +336,14 @@ function executeOperation(
}

const rootFields = collectFields(
exeContext.schema,
exeContext.fragments,
exeContext.variableValues,
schema,
fragments,
variableValues,
rootType,
operation.selectionSet,
);
const path = undefined;

const { rootValue } = exeContext;

switch (operation.operation) {
case OperationTypeNode.QUERY:
return executeFields(exeContext, rootType, rootValue, path, rootFields);
Expand Down