mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
#5237 Fix for incorrect handling of self loops with elk layout
This commit is contained in:
@@ -7,6 +7,11 @@ export const findCommonAncestor = (id1: string, id2: string, treeData: TreeData)
|
||||
const { parentById } = treeData;
|
||||
const visited = new Set();
|
||||
let currentId = id1;
|
||||
|
||||
if (id1 === id2) {
|
||||
return parentById[id1] || 'root';
|
||||
}
|
||||
|
||||
while (currentId) {
|
||||
visited.add(currentId);
|
||||
if (currentId === id2) {
|
||||
|
Reference in New Issue
Block a user