From 428c0bb6117c06f8b8afc7be22645684d908da1d Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Thu, 14 Feb 2019 23:44:49 +0100 Subject: [PATCH] Note Edit: Immediately update that note in the list Otherwise, it's only after syncing and reloading the entire list of notes do we see the update. This process is usually quite fast, but not always. --- lib/state_container.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/state_container.dart b/lib/state_container.dart index 032ea8e8..2efdf44f 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -189,6 +189,14 @@ class StateContainerState extends State { void updateNote(Note note) { print("State Container updateNote"); setState(() { + // Update that specific note + for (var i = 0; i < appState.notes.length; i++) { + var n = appState.notes[i]; + if (n.filePath == note.filePath) { + appState.notes[i] = note; + } + } + noteRepo.updateNote(note).then((NoteRepoResult _) { _syncNotes(); });