From 7199b3ddd6af83bc08db0de5659b4bea22a8222d Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 16 May 2018 19:44:10 +0200 Subject: [PATCH] Minor simplification in extendSchema (#1349) --- src/utilities/extendSchema.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/utilities/extendSchema.js b/src/utilities/extendSchema.js index 46344c5e51..b8fc8b2e43 100644 --- a/src/utilities/extendSchema.js +++ b/src/utilities/extendSchema.js @@ -278,19 +278,20 @@ export function extendSchema( return type; } - if (!extendTypeCache[type.name]) { + const name = type.name; + if (!extendTypeCache[name]) { if (isObjectType(type)) { - extendTypeCache[type.name] = extendObjectType(type); + extendTypeCache[name] = extendObjectType(type); } else if (isInterfaceType(type)) { - extendTypeCache[type.name] = extendInterfaceType(type); + extendTypeCache[name] = extendInterfaceType(type); } else if (isUnionType(type)) { - extendTypeCache[type.name] = extendUnionType(type); + extendTypeCache[name] = extendUnionType(type); } else { // This type is not yet extendable. - extendTypeCache[type.name] = type; + extendTypeCache[name] = type; } } - return (extendTypeCache[type.name]: any); + return (extendTypeCache[name]: any); } function extendObjectType(type: GraphQLObjectType): GraphQLObjectType {