Skip to content

Build your personal knowledge base with Trilium Notes

fix timing issue when saving changes to notes

azivner85215aa440e0
diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js
index c07c9b84e3..241f221604 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();