You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2021/11/18 16:26:46 UTC
[airflow] 01/01: Fix: Do not render undefined graph edges
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch Fix-undefined-graph-edges
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 6d83a963a9a85d60919b797b51b746c2444bd990
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Thu Nov 18 10:24:13 2021 -0600
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 daf83dc..cebdd35 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',