codecae commented on code in PR #53998:
URL: https://github.com/apache/airflow/pull/53998#discussion_r2251984479


##########
airflow-core/src/airflow/ui/src/components/Graph/useGraphLayout.ts:
##########
@@ -210,7 +210,20 @@ const generateElkGraph = ({
 
   const children = nodes.map(formatChildNode);
 
-  const edges = filteredEdges.map((fe) => formatElkEdge(fe, font));
+  // Deduplicate edges that point to the same source/target
+  const edgeMap = new Map<string, EdgeResponse>();
+
+  filteredEdges.forEach((edge) => {
+    const edgeKey = `${edge.source_id}-${edge.target_id}`;
+
+    if (!edgeMap.has(edgeKey)) {
+      edgeMap.set(edgeKey, edge);
+    }
+  });
+
+  // Convert back to array and create formatted edges
+  const deduplicatedEdges = [...edgeMap.values()];
+  const edges = deduplicatedEdges.map((fe) => formatElkEdge(fe, font));

Review Comment:
   I think the duplication is created as a byproduct of changing source and 
targets from tasks to parent task groups when task groups are collapsed.  There 
end up being duplicate edges as that transformation occurs.  This deduplication 
is handled on the front end when a user interacts with the UI.  If I recall, 
collapsing task groups doesn't create any backend requests, does it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to