Skip to content

Commit

Permalink
fix(gatsby-source-drupal): Verify nodes exist before looping through …
Browse files Browse the repository at this point in the history
…them (#22898)

* Verify nodes exist before looping through them

* Update to push nodes directly inside loop

Co-Authored-By: Peter van der Zee <[email protected]>

Co-authored-by: Peter van der Zee <[email protected]>
  • Loading branch information
smthomas and pvdz authored Apr 9, 2020
1 parent c83b85a commit cdbe734
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/gatsby-source-drupal/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ const handleWebhookUpdate = async (
nodesToUpdate.push(...addedReferencedNodes)
} else {
// if we are inserting new node, we need to update all referenced nodes
const newNodeReferencedNodes = referencedNodesLookup
.get(newNode)
.map(id => getNode(id))
nodesToUpdate.push(...newNodeReferencedNodes)
const newNodes = referencedNodesLookup.get(newNode)
if (typeof newNodes !== `undefined`) {
newNodes.forEach(id => nodesToUpdate.push(getNode(id)))
}
}

// download file
Expand Down

0 comments on commit cdbe734

Please sign in to comment.