diff --git a/public/javascripts/dialogs/recent_notes.js b/public/javascripts/dialogs/recent_notes.js index 372288129..014f070bc 100644 --- a/public/javascripts/dialogs/recent_notes.js +++ b/public/javascripts/dialogs/recent_notes.js @@ -11,9 +11,11 @@ const recentNotes = (function() { // list of recent note paths let list = []; - server.get('recent-notes').then(result => { + async function reload() { + const result = await server.get('recent-notes'); + list = result.map(r => r.note_path); - }); + } function addRecentNote(noteTreeId, notePath) { setTimeout(async () => { @@ -127,6 +129,8 @@ const recentNotes = (function() { e.preventDefault(); }); + reload(); + $(document).bind('keydown', 'alt+q', showDialog); selectBoxEl.dblclick(e => { @@ -140,6 +144,7 @@ const recentNotes = (function() { return { showDialog, - addRecentNote + addRecentNote, + reload }; })(); \ No newline at end of file diff --git a/public/javascripts/messaging.js b/public/javascripts/messaging.js index 3e8948174..af3888e16 100644 --- a/public/javascripts/messaging.js +++ b/public/javascripts/messaging.js @@ -33,6 +33,12 @@ const messaging = (function() { noteEditor.reload(); } + if (data.recent_notes) { + console.log("Reloading recent notes because of background changes"); + + recentNotes.reload(); + } + const changesToPushCountEl = $("#changesToPushCount"); changesToPushCountEl.html(message.changesToPushCount); }