From f9f8ecb2b18e8403af940c3afb0f81c7d0f98947 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 11 Feb 2018 15:33:10 -0500 Subject: [PATCH] recent notes doesn't fail totally when we can't find title for some note --- src/public/javascripts/dialogs/recent_notes.js | 11 ++++++++++- src/routes/api/recent_notes.js | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/public/javascripts/dialogs/recent_notes.js b/src/public/javascripts/dialogs/recent_notes.js index ae63b21e4..ae660b1f4 100644 --- a/src/public/javascripts/dialogs/recent_notes.js +++ b/src/public/javascripts/dialogs/recent_notes.js @@ -40,7 +40,16 @@ const recentNotes = (function() { $searchInput.autocomplete({ source: recNotes.map(notePath => { - const noteTitle = noteTree.getNotePathTitle(notePath); + let noteTitle; + + try { + noteTitle = noteTree.getNotePathTitle(notePath); + } + catch (e) { + noteTitle = "[error - can't find note title]"; + + messaging.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack); + } return { label: noteTitle, diff --git a/src/routes/api/recent_notes.js b/src/routes/api/recent_notes.js index 17ea9eb0d..dedca8752 100644 --- a/src/routes/api/recent_notes.js +++ b/src/routes/api/recent_notes.js @@ -45,7 +45,8 @@ async function getRecentNotes() { recent_notes.isDeleted = 0 AND note_tree.isDeleted = 0 ORDER BY - dateAccessed DESC`); + dateAccessed DESC + LIMIT 200`); } module.exports = router; \ No newline at end of file