From e78411f17a574d49f3852dfeab0685f8a05295f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Jamr=C3=B3z?= Date: Wed, 9 Jul 2025 10:53:31 +0200 Subject: [PATCH] Tempo: Fix showing dangling edges in NodeGraph (#107245) * Tempo: Fix showing dangling edges in NodeGraph * Remove comment --- public/app/plugins/panel/nodeGraph/Edge.tsx | 4 +- .../app/plugins/panel/nodeGraph/NodeGraph.tsx | 37 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/public/app/plugins/panel/nodeGraph/Edge.tsx b/public/app/plugins/panel/nodeGraph/Edge.tsx index 7a8a2911c67..ea1fa18f963 100644 --- a/public/app/plugins/panel/nodeGraph/Edge.tsx +++ b/public/app/plugins/panel/nodeGraph/Edge.tsx @@ -17,11 +17,10 @@ interface Props { onClick: (event: MouseEvent, link: EdgeDatumLayout) => void; onMouseEnter: (id: string) => void; onMouseLeave: (id: string) => void; - processedNodesLength: number; } export const Edge = memo(function Edge(props: Props) { - const { edge, onClick, onMouseEnter, onMouseLeave, hovering, svgIdNamespace, processedNodesLength } = props; + const { edge, onClick, onMouseEnter, onMouseLeave, hovering, svgIdNamespace } = props; // Not great typing but after we do layout these properties are full objects not just references const { source, target, sourceNodeRadius, targetNodeRadius } = edge as { @@ -59,7 +58,6 @@ export const Edge = memo(function Edge(props: Props) { onClick(event, edge)} style={{ cursor: 'pointer' }} aria-label={t('nodeGraph.edge.aria-label-from-to', 'Edge from: {{from}} to: {{to}}', { diff --git a/public/app/plugins/panel/nodeGraph/NodeGraph.tsx b/public/app/plugins/panel/nodeGraph/NodeGraph.tsx index 08a06af7b27..4a398abe7a7 100644 --- a/public/app/plugins/panel/nodeGraph/NodeGraph.tsx +++ b/public/app/plugins/panel/nodeGraph/NodeGraph.tsx @@ -290,6 +290,7 @@ export function NodeGraph({ getLinks, dataFrames, nodeLimit, panelId, zoomMode, onMouseLeave={clearEdgeHover} svgIdNamespace={svgIdNamespace} processedNodesLength={processed.nodes.length} + processedEdgesLength={processed.edges.length} /> )} void; onMouseLeave: (id: string) => void; processedNodesLength: number; + processedEdgesLength: number; } const Edges = memo(function Edges(props: EdgesProps) { return ( <> - {props.edges.map((e) => ( - - ))} + {props.edges.map((e, index) => { + return ( + + ); + })} ); }); @@ -462,7 +465,7 @@ interface EdgeLabelsProps { const EdgeLabels = memo(function EdgeLabels(props: EdgeLabelsProps) { return ( <> - {props.edges.map((e, index) => { + {props.edges.map((e) => { // We show the edge label in case user hovers over the edge directly or if they hover over node edge is // connected to. const shouldShow =