From 41f387d2dbc36c24bcc0746e2b8ebf7a5f239564 Mon Sep 17 00:00:00 2001 From: Jonathan Steele Date: Wed, 7 Oct 2020 11:52:50 +0100 Subject: [PATCH] fix: Check if type has locale field (#125) As opposed to locales argument, which is now available on all types regardless of if localisation is present --- gatsby-source-graphcms/gatsby-node.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gatsby-source-graphcms/gatsby-node.js b/gatsby-source-graphcms/gatsby-node.js index 77cb3f1..4914462 100644 --- a/gatsby-source-graphcms/gatsby-node.js +++ b/gatsby-source-graphcms/gatsby-node.js @@ -63,11 +63,7 @@ const createSourcingConfig = async ( (fieldName) => String(queryFields[fieldName].type) === `[${type.name}!]!` ) - const hasLocaleField = (type) => { - const fieldName = pluralRootFieldName(type) - - return queryFields[fieldName].args.some((arg) => arg.name === `locales`) - } + const hasLocaleField = (type) => type.getFields().locale const gatsbyNodeTypes = possibleTypes.map((type) => ({ remoteTypeName: type.name,