From 6d83a963a9a85d60919b797b51b746c2444bd990 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Thu, 18 Nov 2021 10:24:13 -0600 Subject: [PATCH 1/2] Fix: Do not render undefined graph edges A user had an issue where a `targetId` was undefined and that caused the whole graph view to crash. Instead, we should check for the source and target before rendering the edge. --- airflow/www/static/js/graph.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js index daf83dc0cc9b8..cebdd35f30171 100644 --- a/airflow/www/static/js/graph.js +++ b/airflow/www/static/js/graph.js @@ -633,7 +633,12 @@ function expandGroup(nodeId, node) { edges.forEach((edge) => { const sourceId = mapTaskToNode.get(edge.source_id); const targetId = mapTaskToNode.get(edge.target_id); - if (sourceId !== targetId && !g.hasEdge(sourceId, targetId)) { + if ( + sourceId !== targetId + && !g.hasEdge(sourceId, targetId) + && sourceId + && targetId + ) { g.setEdge(sourceId, targetId, { curve: d3.curveBasis, arrowheadClass: 'arrowhead', From cbeaf988eee1332d3dc24455bbbdbee865eba481 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Thu, 18 Nov 2021 10:29:51 -0600 Subject: [PATCH 2/2] move all checks to one line --- airflow/www/static/js/graph.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js index cebdd35f30171..d12450d2b9a81 100644 --- a/airflow/www/static/js/graph.js +++ b/airflow/www/static/js/graph.js @@ -633,12 +633,7 @@ function expandGroup(nodeId, node) { edges.forEach((edge) => { const sourceId = mapTaskToNode.get(edge.source_id); const targetId = mapTaskToNode.get(edge.target_id); - if ( - sourceId !== targetId - && !g.hasEdge(sourceId, targetId) - && sourceId - && targetId - ) { + if (sourceId !== targetId && !g.hasEdge(sourceId, targetId) && sourceId && targetId) { g.setEdge(sourceId, targetId, { curve: d3.curveBasis, arrowheadClass: 'arrowhead',