From faa2011c47254cb8fa3f5ab4a5cff4ed3fa57d39 Mon Sep 17 00:00:00 2001 From: braco Date: Sun, 14 Jun 2020 15:45:51 -0400 Subject: [PATCH] Check for schema.queryType and schema.mutationType Check for top level property before looking deeper into object, was throwing name not found because mutationType doesn't exist in schema object --- packages/ra-data-graphql/src/introspection.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ra-data-graphql/src/introspection.js b/packages/ra-data-graphql/src/introspection.js index 1c4f7528077..261c2883a78 100644 --- a/packages/ra-data-graphql/src/introspection.js +++ b/packages/ra-data-graphql/src/introspection.js @@ -42,8 +42,8 @@ export default async (client, options) => { const queries = schema.types.reduce((acc, type) => { if ( - type.name !== schema.queryType.name && - type.name !== schema.mutationType.name + type.name !== (schema.queryType && schema.queryType.name) && + type.name !== (schema.mutationType && schema.mutationType.name) ) return acc; @@ -52,8 +52,8 @@ export default async (client, options) => { const types = schema.types.filter( type => - type.name !== schema.queryType.name && - type.name !== schema.mutationType.name + type.name !== (schema.queryType && schema.queryType.name) && + type.name !== (schema.mutationType && schema.mutationType.name) ); const isResource = type =>