Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fixes
zadambdf42749f345
diff --git a/src/public/javascripts/entities/note_short.js b/src/public/javascripts/entities/note_short.jsindex ccae6c0fb4..aa50357972 100644--- a/src/public/javascripts/entities/note_short.js+++ b/src/public/javascripts/entities/note_short.js@@ -80,7 +80,7 @@ class NoteShort {const branchIdPos = {};for (const branchId of Object.values(this.childToBranch)) {- branchIdPos[branchId] = this.treeCache.branches[branchId].notePosition;+ branchIdPos[branchId] = this.treeCache.getBranch(branchId).notePosition;}this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex 202d248f6b..545d5f942f 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -824,6 +824,7 @@ async function checkFolderStatus(node) {node.folder = note.type === 'search' || note.getChildNoteIds().length > 0;node.icon = await treeBuilder.getIcon(note);+ node.extraClasses = await treeBuilder.getExtraClasses(note);node.renderTitle();}diff --git a/src/public/javascripts/services/tree_cache.js b/src/public/javascripts/services/tree_cache.jsindex ed905fd9ab..3a672f78a3 100644--- a/src/public/javascripts/services/tree_cache.js+++ b/src/public/javascripts/services/tree_cache.js@@ -31,8 +31,6 @@ class TreeCache {for (const branchRow of branchRows) {const branch = new Branch(this, branchRow);- this.addBranch(branch);-branchesByNotes[branch.noteId] = branchesByNotes[branch.noteId] || [];branchesByNotes[branch.noteId].push(branch);@@ -79,6 +77,10 @@ class TreeCache {}}+ for (const branch of branchesByNotes[noteId]) {+ this.addBranch(branch);+ }+const note = new NoteShort(this, noteRow, branchesByNotes[noteId]);this.notes[note.noteId] = note;@@ -102,7 +104,6 @@ class TreeCache {}async reloadNotes(noteIds) {- // first load the data before clearing the cacheconst resp = await server.post('tree/load', { noteIds });this.addResp(resp.notes, resp.branches);@@ -161,8 +162,9 @@ class TreeCache {if (!(branchId in this.branches)) {console.error(`Not existing branch ${branchId}`);}-- return this.branches[branchId];+ else {+ return this.branches[branchId];+ }}}