Skip to content

High performance self-hosted photo and video management solution.

fix(web): folder view sort oder (#24337)

Jonathan Jogenfors62628dfcfae6
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<string, TreeNode> {
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()) {