From 85215aa440e0f1eba43eac650170711f7244f07e Mon Sep 17 00:00:00 2001 From: azivner Date: Fri, 31 Aug 2018 00:08:04 +0200 Subject: [PATCH] fix timing issue when saving changes to notes --- src/public/javascripts/services/note_detail.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index c07c9b84e..241f22160 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -99,11 +99,14 @@ async function saveNote() { note.title = $noteTitle.val(); note.content = getComponent(note.type).getContent(); + // it's important to set the flag back to false immediatelly after retrieving title and content + // otherwise we might overwrite another change (especially async code) + isNoteChanged = false; + treeService.setNoteTitle(note.noteId, note.title); await server.put('notes/' + note.noteId, note.dto); - isNoteChanged = false; if (note.isProtected) { protectedSessionHolder.touchProtectedSession();