Skip to content

Commit 62628df

Browse files
authored
fix(web): folder view sort oder (#24337)
fix: folder view sort oder
1 parent b11aecd commit 62628df

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

web/src/lib/utils/tree-utils.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ export class TreeNode extends Map<string, TreeNode> {
6262
const child = this.values().next().value!;
6363
child.value = joinPaths(this.value, child.value);
6464
child.parent = this.parent;
65-
this.parent.delete(this.value);
66-
this.parent.set(child.value, child);
65+
66+
const entries = Array.from(this.parent.entries());
67+
this.parent.clear();
68+
for (const [key, value] of entries) {
69+
if (key === this.value) {
70+
this.parent.set(child.value, child);
71+
} else {
72+
this.parent.set(key, value);
73+
}
74+
}
6775
}
6876

6977
for (const child of this.values()) {

0 commit comments

Comments
 (0)