Prevent dagre error by checking if source node actually exists before creating edge
This commit is contained in:
parent
7a73d071cf
commit
ce2e13d9e4
|
|
@ -338,7 +338,15 @@ export class ElsaWorkflowDesigner {
|
|||
});
|
||||
|
||||
this.workflowModel.connections.forEach(({sourceId, targetId, outcome}) => {
|
||||
this.graph.setEdge(`${sourceId}/${outcome}`, targetId, {arrowhead: 'undirected'});
|
||||
const sourceName = `${sourceId}/${outcome}`;
|
||||
|
||||
if(!this.graph.hasNode(sourceName))
|
||||
{
|
||||
console.warn(`No source node with ID '${sourceName}' exists.`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.graph.setEdge(sourceName, targetId, {arrowhead: 'undirected'});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue