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
avoid double rendering of note paths
zadam51dfe8bb1490
diff --git a/src/public/app/widgets/ribbon_widgets/note_paths.js b/src/public/app/widgets/ribbon_widgets/note_paths.jsindex 6d05ee4a0d..fd7a1c906b 100644--- a/src/public/app/widgets/ribbon_widgets/note_paths.js+++ b/src/public/app/widgets/ribbon_widgets/note_paths.js@@ -69,7 +69,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget {this.$notePathList.empty();if (this.noteId === 'root') {- await this.addPath('root');+ await this.getRenderedPath('root');return;}@@ -83,22 +83,18 @@ export default class NotePathsWidget extends NoteContextAwareWidget {this.$notePathIntro.text("This note is not yet placed into the note tree.");}- const printedNotePaths = new Set();+ const renderedPaths = [];for (const notePathRecord of sortedNotePaths) {const notePath = notePathRecord.notePath.join('/');- if (printedNotePaths.has(notePath)) {- continue;- }-- printedNotePaths.add(notePath);-- await this.addPath(notePath, notePathRecord);+ renderedPaths.push(await this.getRenderedPath(notePath, notePathRecord));}++ this.$notePathList.empty().append(...renderedPaths);}- async addPath(notePath, notePathRecord) {+ async getRenderedPath(notePath, notePathRecord) {const title = await treeService.getNotePathTitle(notePath);const $noteLink = await linkService.createNoteLink(notePath, {title});@@ -136,7 +132,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget {$noteLink.append(` ${icons.join(' ')}`);}- this.$notePathList.append($("<li>").append($noteLink));+ return $("<li>").append($noteLink);}entitiesReloadedEvent({loadResults}) {