When viewing an email and then deleting (or archiving/moving/snoozing) it, the app navigates to the next email in the thread list.
getEmailBody fetches from the network on a cache miss, causing the hourglass / loading spinner the issue describes.
EmailDetailNotifier now fires a background getEmailBody call for the next thread's latestEmailId as soon as the current email finishes loading.
getEmailBody already caches results in the EmailBodies table with a 7-day TTL, so by the time the user triggers a navigation action the body is pre-warmed and renders instantly.
What changed
lib/di.dart — EmailDetailNotifier.build() calls _prefetchNextEmailBody (fire-and-forget via unawaited) after loading the current email. The helper respects the afterMailViewAction user preference: if set to showMailbox it does nothing.
Test plan
Open an email, delete it — next email should appear without the spinner
Verify the same for archive, move, and snooze actions
Verify behaviour is unchanged when afterMailViewAction is set to showMailbox
Verify the last email in the list still pops back to the mailbox list correctly
## Summary
- When viewing an email and then deleting (or archiving/moving/snoozing) it, the app navigates to the next email in the thread list.
- `getEmailBody` fetches from the network on a cache miss, causing the hourglass / loading spinner the issue describes.
- `EmailDetailNotifier` now fires a background `getEmailBody` call for the next thread's `latestEmailId` as soon as the current email finishes loading.
- `getEmailBody` already caches results in the `EmailBodies` table with a 7-day TTL, so by the time the user triggers a navigation action the body is pre-warmed and renders instantly.
## What changed
`lib/di.dart` — `EmailDetailNotifier.build()` calls `_prefetchNextEmailBody` (fire-and-forget via `unawaited`) after loading the current email. The helper respects the `afterMailViewAction` user preference: if set to `showMailbox` it does nothing.
## Test plan
- [ ] Open an email, delete it — next email should appear without the spinner
- [ ] Verify the same for archive, move, and snooze actions
- [ ] Verify behaviour is unchanged when `afterMailViewAction` is set to `showMailbox`
- [ ] Verify the last email in the list still pops back to the mailbox list correctly
Closes #367
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
getEmailBodyfetches from the network on a cache miss, causing the hourglass / loading spinner the issue describes.EmailDetailNotifiernow fires a backgroundgetEmailBodycall for the next thread'slatestEmailIdas soon as the current email finishes loading.getEmailBodyalready caches results in theEmailBodiestable with a 7-day TTL, so by the time the user triggers a navigation action the body is pre-warmed and renders instantly.What changed
lib/di.dart—EmailDetailNotifier.build()calls_prefetchNextEmailBody(fire-and-forget viaunawaited) after loading the current email. The helper respects theafterMailViewActionuser preference: if set toshowMailboxit does nothing.Test plan
afterMailViewActionis set toshowMailboxCloses #367