mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
avoid double rendering of note paths
This commit is contained in:
parent
e426ee3e4f
commit
51dfe8bb14
@ -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}) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user