fix(reactflowUtils.ts): fix null pointer error when accessing nested properties in connectedInputNodesOnHandle function

This commit is contained in:
anovazzi1 2023-09-10 23:57:22 -03:00
commit 772bfbf1d3

View file

@ -668,13 +668,13 @@ export function connectedInputNodesOnHandle(
const sourceNode = nodes.find((n) => n.id === edge.source);
if (sourceNode) {
if (sourceNode.type === "groupNode") {
let lastNode = findLastNode(sourceNode.data.node.flow.data);
let lastNode = findLastNode(sourceNode.data.node!.flow!.data!);
while (lastNode && lastNode.type === "groupNode") {
lastNode = findLastNode(lastNode.data.node.flow.data);
lastNode = findLastNode(lastNode.data.node!.flow!.data!);
}
if (lastNode) {
connectedNodes.push({
name: sourceNode.data.node.flow.name,
name: sourceNode.data.node!.flow!.name,
id: lastNode.id,
isGroup: true,
});