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
) (#37960)

Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com>
  • Loading branch information
ViCo0TeCH and TylerBarnes committed Apr 19, 2023
1 parent e95b10a commit 52ad261
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 52ad261

Please sign in to comment.