mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
Delete Note: Do not sync untill the snackbar has gone
Otherwise we would have already pushed that change to the server, and undo-ing it will be impossible.
This commit is contained in:
@ -166,7 +166,12 @@ class StateContainerState extends State<StateContainer> {
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user