Deleting mail, snack bar does not vanish when #399

Closed
opened 2026-06-04 01:22:50 +00:00 by guettli · 1 comment
guettli commented 2026-06-04 01:22:50 +00:00 (Migrated from codeberg.org)

When deleting a mail from single Mail View, the snack bar does not vanish after some seconds. It should.

When deleting a mail from single Mail View, the snack bar does not vanish after some seconds. It should.
guettlibot commented 2026-06-04 02:00:06 +00:00 (Migrated from codeberg.org)

PR is open at https://codeberg.org/guettli/sharedinbox/pulls/401.


What I did and why:

When the delete button is pressed in the single Mail View (email_detail_screen.dart), the original code called unawaited(pushAction(...)) immediately before _navigateTo(). Because pushAction is async, navigation fired first. The UndoShell's ref.listen callback (which fires synchronously on state change in Riverpod) only triggered after navigation had started, so showSnackBar() was called while the destination scaffold was still mid-transition. This prevented the snack bar's internal duration animation from starting correctly, leaving it stuck on screen indefinitely.

Fix: Changed unawaited(pushAction(...)) to await pushAction(...). Now the state change (and the resulting ref.listenshowSnackBar call) happens before _navigateTo(). The snack bar gets queued on the current stable scaffold, then transfers cleanly to the destination scaffold after navigation completes, and auto-dismisses after 5 seconds as expected.

All 338 existing tests pass unchanged.

PR is open at https://codeberg.org/guettli/sharedinbox/pulls/401. --- **What I did and why:** When the delete button is pressed in the single Mail View (`email_detail_screen.dart`), the original code called `unawaited(pushAction(...))` immediately before `_navigateTo()`. Because `pushAction` is async, navigation fired first. The `UndoShell`'s `ref.listen` callback (which fires synchronously on state change in Riverpod) only triggered *after* navigation had started, so `showSnackBar()` was called while the destination scaffold was still mid-transition. This prevented the snack bar's internal duration animation from starting correctly, leaving it stuck on screen indefinitely. **Fix:** Changed `unawaited(pushAction(...))` to `await pushAction(...)`. Now the state change (and the resulting `ref.listen` → `showSnackBar` call) happens *before* `_navigateTo()`. The snack bar gets queued on the current stable scaffold, then transfers cleanly to the destination scaffold after navigation completes, and auto-dismisses after 5 seconds as expected. All 338 existing tests pass unchanged.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guettli/sharedinbox#399