Skip to content

Commit

Permalink
refactor: use spread syntax with exeContext
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Jun 19, 2022
1 parent 3a2fc8b commit 4e0ed36
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,9 @@ export function buildExecutionContext(
function executeOperation(
exeContext: ExecutionContext,
): PromiseOrValue<ObjMap<unknown>> {
const { operation } = exeContext;
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 @@ -335,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

0 comments on commit 4e0ed36

Please sign in to comment.