fix: snack bar now auto-dismisses after delete in mail detail view (#401)
## Summary - When deleting a mail from the single Mail View, \`pushAction()\` was called with \`unawaited\` before \`_navigateTo()\`. This meant the UndoShell snack bar fired *after* navigation had already started, showing the snack bar on the destination scaffold mid-transition — which prevented the snack bar's duration timer from starting correctly. - Fixed by changing \`unawaited(pushAction(...))\` to \`await pushAction(...)\`. Since Riverpod fires \`ref.listen\` synchronously when state changes, the UndoShell now queues the snack bar on the current stable scaffold *before* \`_navigateTo()\` is called. The snack bar then naturally transfers to the destination scaffold and auto-dismisses after 5 seconds as intended. Closes #399 ## Test plan - [x] All 338 unit/widget tests pass - [ ] Manually delete a mail from single Mail View and verify the snack bar appears and auto-dismisses after ~5 seconds - [ ] Verify the Undo button in the snack bar still works Co-authored-by: Thomas SharedInbox <sharedinbox@thomas-guettler.de> Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/401
This commit was merged in pull request #401.
This commit is contained in:
committed by
guettli
co-authored by
guettli
Thomas SharedInbox
parent
674d402ff9
commit
582f6764eb
@@ -93,8 +93,7 @@ class _EmailDetailScreenState extends ConsumerState<EmailDetailScreen> {
|
||||
final destPath = await repo.deleteEmail(widget.emailId);
|
||||
|
||||
if (header != null) {
|
||||
unawaited(
|
||||
ref.read(undoServiceProvider.notifier).pushAction(
|
||||
await ref.read(undoServiceProvider.notifier).pushAction(
|
||||
UndoAction(
|
||||
id: DateTime.now().toIso8601String(),
|
||||
accountId: header.accountId,
|
||||
@@ -104,7 +103,6 @@ class _EmailDetailScreenState extends ConsumerState<EmailDetailScreen> {
|
||||
destinationMailboxPath: destPath,
|
||||
originalEmails: [header],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user