From f763e139967cf333d030bce8cc95c398ddd6af5c Mon Sep 17 00:00:00 2001 From: azivner Date: Thu, 13 Dec 2018 21:43:13 +0100 Subject: [PATCH] fix searching without hoisting --- src/services/note_cache.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/services/note_cache.js b/src/services/note_cache.js index 6c7fef274..5f98cf11b 100644 --- a/src/services/note_cache.js +++ b/src/services/note_cache.js @@ -219,13 +219,8 @@ function getNoteTitle(noteId, parentNoteId) { function getNoteTitleArrayForPath(path) { const titles = []; - if (path[0] === hoistedNoteService.getHoistedNoteId()) { - if (path.length === 1) { - return [ getNoteTitle(hoistedNoteService.getHoistedNoteId()) ]; - } - else { - path = path.slice(1); - } + if (path[0] === hoistedNoteService.getHoistedNoteId() && path.length === 1) { + return [ getNoteTitle(hoistedNoteService.getHoistedNoteId()) ]; } let parentNoteId = 'root'; @@ -257,13 +252,13 @@ function getNoteTitleForPath(path) { function getSomePath(noteId, path) { if (noteId === 'root') { + path.push(noteId); + path.reverse(); + if (!path.includes(hoistedNoteService.getHoistedNoteId())) { return false; } - path.push(noteId); - path.reverse(); - return path; }