Skip to content

Commit d806703

Browse files
GatsbyJS Botlwz7512ascorbic
authored
fix(gatsby-source-wordpress):issue #29535 not finished createSchemaCu… (#29554) (#29712)
Co-authored-by: gatsbybot <[email protected]> (cherry picked from commit 308d418) Co-authored-by: liwenzhi <[email protected]> Co-authored-by: Matt Kane <[email protected]>
1 parent 49f19fd commit d806703

File tree

1 file changed

+4
-1
lines changed
  • packages/gatsby-source-wordpress/src/steps/create-schema-customization

1 file changed

+4
-1
lines changed

packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ const objectType = typeBuilderApi => {
134134
})
135135

136136
// if all child fields are excluded, this type shouldn't exist.
137-
if (!Object.keys(transformedFields).length) {
137+
// check null first, otherwise cause:
138+
// TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>)
139+
// Also cause wordpress blog site build failure in createSchemaCustomization step
140+
if (!transformedFields || !Object.keys(transformedFields).length) {
138141
return
139142
}
140143

0 commit comments

Comments
 (0)