From a6bef45a3025bba638e182e168ac55fbb01c5bbc Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 8 Jul 2021 13:06:22 +0200 Subject: [PATCH] fix "root" note in edited notes, closes #2058 --- src/services/note_cache/note_cache_service.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/services/note_cache/note_cache_service.js b/src/services/note_cache/note_cache_service.js index 3d685c681..65a76a93d 100644 --- a/src/services/note_cache/note_cache_service.js +++ b/src/services/note_cache/note_cache_service.js @@ -171,11 +171,20 @@ function getNotePath(noteId) { if (retPath) { const noteTitle = getNoteTitleForPath(retPath); - const parentNote = note.parents[0]; + + let branchId; + + if (note.noteId === 'root') { + branchId = 'root'; + } + else { + const parentNote = note.parents[0]; + branchId = noteCache.getBranch(noteId, parentNote.noteId).branchId; + } return { noteId: noteId, - branchId: noteCache.getBranch(noteId, parentNote.noteId).branchId, + branchId: branchId, title: noteTitle, notePath: retPath, path: retPath.join('/')