avoid resorting children on every child add, fixes #1480

This commit is contained in:
zadam
2020-12-10 16:10:10 +01:00
parent 33571e0ef3
commit 4633c68a0c
3 changed files with 15 additions and 4 deletions

View File

@@ -75,14 +75,16 @@ class NoteShort {
this.parentToBranch[parentNoteId] = branchId;
}
addChild(childNoteId, branchId) {
addChild(childNoteId, branchId, sort = true) {
if (!this.children.includes(childNoteId)) {
this.children.push(childNoteId);
}
this.childToBranch[childNoteId] = branchId;
this.sortChildren();
if (sort) {
this.sortChildren();
}
}
sortChildren() {