filter out duplicated note paths, fixes #2218

This commit is contained in:
zadam
2021-10-11 21:08:25 +02:00
parent 1ad25b063d
commit ec732c0a98
3 changed files with 19 additions and 11 deletions

View File

@@ -83,14 +83,22 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
this.$notePathIntro.text("This note is not yet placed into the note tree.");
}
const printedNotePaths = new Set();
for (const notePathRecord of sortedNotePaths) {
await this.addPath(notePathRecord);
const notePath = notePathRecord.notePath.join('/');
if (printedNotePaths.has(notePath)) {
continue;
}
printedNotePaths.add(notePath);
await this.addPath(notePath, notePathRecord);
}
}
async addPath(notePathRecord) {
const notePath = notePathRecord.notePath.join('/');
async addPath(notePath, notePathRecord) {
const title = await treeService.getNotePathTitle(notePath);
const $noteLink = await linkService.createNoteLink(notePath, {title});