Skip to content

Commit

Permalink
fix(gatsby-source-contentful): don't call createNode on null (#37958
Browse files Browse the repository at this point in the history
)
  • Loading branch information
TylerBarnes authored Apr 19, 2023
1 parent d6b7cd2 commit da9a8f5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/gatsby-source-contentful/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,20 @@ export const createNodesForContentType = async ({
})

entryNodes.forEach((entryNode, index) => {
create(entryNode, () => {
entryNodes[index] = undefined
})
// entry nodes may be undefined here if the node was previously already created
if (entryNode) {
create(entryNode, () => {
entryNodes[index] = undefined
})
}
})
childrenNodes.forEach((entryNode, index) => {
create(entryNode, () => {
childrenNodes[index] = undefined
})
// entry nodes may be undefined here if the node was previously already created
if (entryNode) {
create(entryNode, () => {
childrenNodes[index] = undefined
})
}
})
})

Expand Down

0 comments on commit da9a8f5

Please sign in to comment.