From 62628dfcfae606f2cf578c6008e82013830fd882 Mon Sep 17 00:00:00 2001 From: Jonathan Jogenfors Date: Tue, 2 Dec 2025 18:48:12 +0100 Subject: [PATCH] fix(web): folder view sort oder (#24337) fix: folder view sort oder --- web/src/lib/utils/tree-utils.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/src/lib/utils/tree-utils.ts b/web/src/lib/utils/tree-utils.ts index 267bb2eec7..64b51158c4 100644 --- a/web/src/lib/utils/tree-utils.ts +++ b/web/src/lib/utils/tree-utils.ts @@ -62,8 +62,16 @@ export class TreeNode extends Map { const child = this.values().next().value!; child.value = joinPaths(this.value, child.value); child.parent = this.parent; - this.parent.delete(this.value); - this.parent.set(child.value, child); + + const entries = Array.from(this.parent.entries()); + this.parent.clear(); + for (const [key, value] of entries) { + if (key === this.value) { + this.parent.set(child.value, child); + } else { + this.parent.set(key, value); + } + } } for (const child of this.values()) {