Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless check since args are always array (can be empty) #2049

Merged
merged 1 commit into from Jul 23, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/execution/values.js
Expand Up @@ -124,11 +124,11 @@ export function getArgumentValues(
variableValues?: ?ObjMap<mixed>,
): { [argument: string]: mixed, ... } {
const coercedValues = {};
const argDefs = def.args;
const argNodes = node.arguments;
if (!argDefs || !argNodes) {
if (!argNodes) {
return coercedValues;
}
const argDefs = def.args;
const argNodeMap = keyMap(argNodes, arg => arg.name.value);
for (let i = 0; i < argDefs.length; i++) {
const argDef = argDefs[i];
Expand Down
6 changes: 2 additions & 4 deletions src/type/schema.js
Expand Up @@ -352,10 +352,8 @@ function typeMapReducer(map: TypeMap, type: ?GraphQLType): TypeMap {

if (isObjectType(type) || isInterfaceType(type)) {
for (const field of objectValues(type.getFields())) {
if (field.args) {
const fieldArgTypes = field.args.map(arg => arg.type);
reducedMap = fieldArgTypes.reduce(typeMapReducer, reducedMap);
}
const fieldArgTypes = field.args.map(arg => arg.type);
reducedMap = fieldArgTypes.reduce(typeMapReducer, reducedMap);
reducedMap = typeMapReducer(reducedMap, field.type);
}
}
Expand Down