Skip to content

Commit

Permalink
[gatsby-source-filesystem] check if parent exists
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed May 11, 2018
1 parent 2b7467d commit 3c8200f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/gatsby-source-wordpress/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ exports.mapElementsToParent = entities =>
entities.map(e => {
if (e.wordpress_parent) {
// Create parent_element with a link to the parent node of type.
e.parent_element___NODE = entities.find(
const parentElement = entities.find(
t => t.wordpress_id === e.wordpress_parent && t.__type === e.__type
).id
)
if (parentElement) {
e.parent_element___NODE = parentElement.id
}
}
return e
})
Expand Down

0 comments on commit 3c8200f

Please sign in to comment.