When a folder is open and it is making a network request with no prior messages to display, it should show a wait spinner rather than showing "No messages to display" until the network request completes #149
Reference in New Issue
Block a user
Context
MailboxViewModel.selectFolder()(ui/mailbox/MailboxViewModel.kt, ~lines 363-369) kicks off abackground
mailSyncer.syncFolder(...)fire-and-forget but exposes no loading flag for it —_isRefreshingis only set by the explicit pull-to-refresh path (refresh(), ~lines 407-424).The
messagesStateFlow(~lines 128-154) reads straight from the local Room cache viaobserveFolderMessages, so opening a folder with no cached rows yet emits an empty listimmediately, before the background fetch has a chance to populate anything.
In
MailboxScreen.kt's non-paged branch (the per-account/folder path, ~lines 331-338), an emptymessageslist rendersNoMessagesStateunconditionally. This is inconsistent with the unifiedinbox's paged branch just above it (~lines 296-304), which already holds the empty state back
while
pagedMessages.loadState.refresh is LoadState.Loading. So per-account folder opens flash"No messages to display" while the initial IMAP fetch for that folder is still in flight —
exactly the bug this ticket describes.
Scope
MailboxViewModel, set for the duration of theselectFolder-triggeredsyncFoldercall (mirroring_isRefreshing's pattern; either anew flow or a generalization of
_isRefreshingif the two cases turn out to be behaviorallyequivalent — decide during implementation).
MailboxScreen.kt's non-paged empty branch (~line 331), gateNoMessagesStateon thatflag the same way the paged branch already gates on
loadState.refresh(~line 301), showinga
CircularProgressIndicatorwhile the initial fetch is in flight instead.syncFoldercompletes regardless of outcome (success,failure, or cancellation from rapid folder switching), so a genuinely empty, already-synced
folder still shows "No messages to display" rather than spinning forever.
Acceptance criteria
IMAP fetch completes, then either the fetched messages or, if the folder truly is empty,
"No messages to display".
Relevant files
ui/mailbox/MailboxViewModel.kt(~lines 128-154, 363-369, 407-424),ui/mailbox/MailboxScreen.kt(~lines 290-338).