Skip to content

Commit

Permalink
Check that edge nodes actually exist
Browse files Browse the repository at this point in the history
  • Loading branch information
bbovenzi committed Jun 6, 2022
1 parent fd4e344 commit 4b304ab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion airflow/www/static/js/dag_dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,14 @@ const renderGraph = () => {
g.setNode(node.id, node.value);
});

// filter out edges that point to non-existent nodes
const realEdges = edges.filter((e) => {
const edgeNodes = nodes.filter((n) => n.id === e.u || n.id === e.v);
return edgeNodes.length === 2;
});

// Set edges
edges.forEach((edge) => {
realEdges.forEach((edge) => {
g.setEdge(edge.u, edge.v, {
curve: d3.curveBasis,
arrowheadClass: 'arrowhead',
Expand Down

0 comments on commit 4b304ab

Please sign in to comment.