Skip to content

Commit

Permalink
fix: Check if type has locale field (#125)
Browse files Browse the repository at this point in the history
As opposed to locales argument, which is now available on all types regardless of if localisation is present
  • Loading branch information
Jonathan Steele authored Oct 7, 2020
1 parent e256fe7 commit 41f387d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions gatsby-source-graphcms/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 41f387d

Please sign in to comment.