Skip to content

Commit cdbe734

Browse files
smthomaspvdz
andauthored
fix(gatsby-source-drupal): Verify nodes exist before looping through them (#22898)
* Verify nodes exist before looping through them * Update to push nodes directly inside loop Co-Authored-By: Peter van der Zee <209817+pvdz@users.noreply.github.com> Co-authored-by: Peter van der Zee <209817+pvdz@users.noreply.github.com>
1 parent c83b85a commit cdbe734

File tree

1 file changed

+4
-4
lines changed
  • packages/gatsby-source-drupal/src

1 file changed

+4
-4
lines changed

packages/gatsby-source-drupal/src/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ const handleWebhookUpdate = async (
147147
nodesToUpdate.push(...addedReferencedNodes)
148148
} else {
149149
// if we are inserting new node, we need to update all referenced nodes
150-
const newNodeReferencedNodes = referencedNodesLookup
151-
.get(newNode)
152-
.map(id => getNode(id))
153-
nodesToUpdate.push(...newNodeReferencedNodes)
150+
const newNodes = referencedNodesLookup.get(newNode)
151+
if (typeof newNodes !== `undefined`) {
152+
newNodes.forEach(id => nodesToUpdate.push(getNode(id)))
153+
}
154154
}
155155

156156
// download file

0 commit comments

Comments
 (0)