diff --git a/lib/state_container.dart b/lib/state_container.dart index f9d77363..62f1ae06 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -166,7 +166,12 @@ class StateContainerState extends State { void removeNote(Note note) { setState(() { appState.notes.remove(note); - noteRepo.removeNote(note).then((NoteRepoResult _) { + noteRepo.removeNote(note).then((NoteRepoResult _) async { + // FIXME: Is there a way of figuring this amount dynamically? + // The '4 seconds' is taken from snack_bar.dart -> _kSnackBarDisplayDuration + // We wait an aritfical amount of time, so that the user has a change to undo + // their delete operation, and that commit is not synced with the server, till then. + await Future.delayed(const Duration(seconds: 4)); _syncNotes(); }); });