fix: prevent loading flash when switching to a cached account

This commit is contained in:
Linus Rath
2026-07-22 17:42:48 +02:00
parent 7beaf991e8
commit 5818e60401
2 changed files with 28 additions and 13 deletions
+8 -3
View File
@@ -980,11 +980,16 @@ export default function Home() {
await refreshScheduledMetadata(client);
// Fetch emails for the selected mailbox after scheduled metadata is available.
// Fetch emails for the selected mailbox after scheduled metadata is
// available. If the list is already populated (an account switch
// restored a cached snapshot, or login prefetched it), refresh in the
// background so the visible mail doesn't flash a loading overlay; only
// a genuine empty first load shows the skeleton.
const background = state.emails.length > 0;
if (selectedMailboxId) {
await fetchEmails(client, selectedMailboxId);
await fetchEmails(client, selectedMailboxId, { background });
} else {
await fetchEmails(client);
await fetchEmails(client, undefined, { background });
}
fetchTagCounts(client);