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

12
package-lock.json generated
View File

@ -2855,9 +2855,9 @@
} }
}, },
"electron": { "electron": {
"version": "13.5.1", "version": "13.5.2",
"resolved": "https://registry.npmjs.org/electron/-/electron-13.5.1.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-13.5.2.tgz",
"integrity": "sha512-ZyxhIhmdaeE3xiIGObf0zqEyCyuIDqZQBv9NKX8w5FNzGm87j4qR0H1+GQg6vz+cA1Nnv1x175Zvimzc0/UwEQ==", "integrity": "sha512-CPakwDpy5m8dL0383F5uJboQcVtn9bT/+6/wdDKo8LuTUO9aER1TF41v7feZgZW2c+UwoGPWa814ElSQ3qta2A==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",
@ -2866,9 +2866,9 @@
}, },
"dependencies": { "dependencies": {
"@types/node": { "@types/node": {
"version": "14.17.20", "version": "14.17.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.20.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.21.tgz",
"integrity": "sha512-gI5Sl30tmhXsqkNvopFydP7ASc4c2cLfGNQrVKN3X90ADFWFsPEsotm/8JHSUJQKTHbwowAHtcJPeyVhtKv0TQ==", "integrity": "sha512-zv8ukKci1mrILYiQOwGSV4FpkZhyxQtuFWGya2GujWg+zVAeRQ4qbaMmWp9vb9889CFA8JECH7lkwCL6Ygg8kA==",
"dev": true "dev": true
} }
} }

View File

@ -81,7 +81,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "13.5.1", "electron": "13.5.2",
"electron-builder": "22.13.1", "electron-builder": "22.13.1",
"electron-packager": "15.4.0", "electron-packager": "15.4.0",
"electron-rebuild": "3.2.3", "electron-rebuild": "3.2.3",

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."); this.$notePathIntro.text("This note is not yet placed into the note tree.");
} }
for (const notePathRecord of sortedNotePaths) { const printedNotePaths = new Set();
await this.addPath(notePathRecord);
}
}
async addPath(notePathRecord) { for (const notePathRecord of sortedNotePaths) {
const notePath = notePathRecord.notePath.join('/'); const notePath = notePathRecord.notePath.join('/');
if (printedNotePaths.has(notePath)) {
continue;
}
printedNotePaths.add(notePath);
await this.addPath(notePath, notePathRecord);
}
}
async addPath(notePath, notePathRecord) {
const title = await treeService.getNotePathTitle(notePath); const title = await treeService.getNotePathTitle(notePath);
const $noteLink = await linkService.createNoteLink(notePath, {title}); const $noteLink = await linkService.createNoteLink(notePath, {title});