From ec732c0a98db1cff7df3dd3a87e891bb5cee02da Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 11 Oct 2021 21:08:25 +0200 Subject: [PATCH] filter out duplicated note paths, fixes #2218 --- package-lock.json | 12 ++++++------ package.json | 2 +- .../app/widgets/ribbon_widgets/note_paths.js | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 42900b8ac..0fc7a875c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2855,9 +2855,9 @@ } }, "electron": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/electron/-/electron-13.5.1.tgz", - "integrity": "sha512-ZyxhIhmdaeE3xiIGObf0zqEyCyuIDqZQBv9NKX8w5FNzGm87j4qR0H1+GQg6vz+cA1Nnv1x175Zvimzc0/UwEQ==", + "version": "13.5.2", + "resolved": "https://registry.npmjs.org/electron/-/electron-13.5.2.tgz", + "integrity": "sha512-CPakwDpy5m8dL0383F5uJboQcVtn9bT/+6/wdDKo8LuTUO9aER1TF41v7feZgZW2c+UwoGPWa814ElSQ3qta2A==", "dev": true, "requires": { "@electron/get": "^1.0.1", @@ -2866,9 +2866,9 @@ }, "dependencies": { "@types/node": { - "version": "14.17.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.20.tgz", - "integrity": "sha512-gI5Sl30tmhXsqkNvopFydP7ASc4c2cLfGNQrVKN3X90ADFWFsPEsotm/8JHSUJQKTHbwowAHtcJPeyVhtKv0TQ==", + "version": "14.17.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.21.tgz", + "integrity": "sha512-zv8ukKci1mrILYiQOwGSV4FpkZhyxQtuFWGya2GujWg+zVAeRQ4qbaMmWp9vb9889CFA8JECH7lkwCL6Ygg8kA==", "dev": true } } diff --git a/package.json b/package.json index 5505c463f..f5e385d5f 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ }, "devDependencies": { "cross-env": "7.0.3", - "electron": "13.5.1", + "electron": "13.5.2", "electron-builder": "22.13.1", "electron-packager": "15.4.0", "electron-rebuild": "3.2.3", diff --git a/src/public/app/widgets/ribbon_widgets/note_paths.js b/src/public/app/widgets/ribbon_widgets/note_paths.js index 3e22657a0..6d05ee4a0 100644 --- a/src/public/app/widgets/ribbon_widgets/note_paths.js +++ b/src/public/app/widgets/ribbon_widgets/note_paths.js @@ -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});