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
5 changes: 1 addition & 4 deletions src/execution/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,13 @@ export function buildExecutionContext(
return coercedVariableValues.errors;
}

const variableValues = coercedVariableValues.coerced;
invariant(variableValues, 'Has variables if no errors.');

return {
schema,
fragments,
rootValue,
contextValue,
operation,
variableValues,
variableValues: coercedVariableValues.coerced,
fieldResolver: fieldResolver || defaultFieldResolver,
typeResolver: typeResolver || defaultTypeResolver,
errors: [],
Expand Down
11 changes: 4 additions & 7 deletions src/execution/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ import { coerceValue } from '../utilities/coerceValue';
import { typeFromAST } from '../utilities/typeFromAST';
import { valueFromAST } from '../utilities/valueFromAST';

type CoercedVariableValues = {|
errors: $ReadOnlyArray<GraphQLError> | void,
coerced: { [variable: string]: mixed, ... } | void,
|};
type CoercedVariableValues =
| {| errors: $ReadOnlyArray<GraphQLError> |}
| {| coerced: { [variable: string]: mixed, ... } |};

/**
* Prepares an object map of variableValues of the correct type based on the
Expand Down Expand Up @@ -108,9 +107,7 @@ export function getVariableValues(
coercedValues[varName] = coerced.value;
}

return errors.length === 0
? { errors: undefined, coerced: coercedValues }
: { errors, coerced: undefined };
return errors.length === 0 ? { coerced: coercedValues } : { errors };
}

/**
Expand Down