From a303a21a9beece770da88e507487593c1ce1f6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sunny=20=28SunJae=29=20Lee=20=EC=9D=B4=EC=84=A0=EC=9E=AC?= Date: Thu, 2 Jan 2025 15:29:58 +0900 Subject: [PATCH] fix: rank undefined issue --- frontend/SankeyDiagram.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/SankeyDiagram.vue b/frontend/SankeyDiagram.vue index 144c817..0c7001a 100644 --- a/frontend/SankeyDiagram.vue +++ b/frontend/SankeyDiagram.vue @@ -132,13 +132,17 @@ export default { if (node.rank !== "clade") { let lastLineageNode = currentLineage[currentLineage.length - 1]; if (lastLineageNode) { - let currentRank = rankHierarchyFull[node.rank] ?? Infinity; let lastRank = rankHierarchyFull[lastLineageNode.rank] ?? Infinity; - while (lastLineageNode && currentRank <= lastRank) { + + while (lastLineageNode && currentRank <= lastRank) { const poppedNode = currentLineage.pop(); lastLineageNode = currentLineage[currentLineage.length - 1]; + if (!lastLineageNode) { + break; // Exit the loop if no more nodes in the lineage + } + currentRank = rankHierarchyFull[node.rank] ?? Infinity; lastRank = rankHierarchyFull[lastLineageNode.rank] ?? Infinity; }