Neah version mail remove mail correction 6

This commit is contained in:
alma 2025-04-16 20:52:08 +02:00
parent 1407050052
commit 2173232f67

View File

@ -601,11 +601,13 @@ export default function MailPage() {
flags: email.flags || []
}));
// Update unread count for INBOX
const unreadInboxEmails = processedEmails.filter(
(email: Email) => !email.read && email.folder === 'INBOX'
).length;
setUnreadCount(unreadInboxEmails);
// Only update unread count if we're in the Inbox folder
if (currentView === 'INBOX') {
const unreadInboxEmails = processedEmails.filter(
(email: Email) => !email.read && email.folder === 'INBOX'
).length;
setUnreadCount(unreadInboxEmails);
}
// Update emails state based on whether we're loading more
if (isLoadMore) {
@ -1550,11 +1552,6 @@ export default function MailPage() {
}
const data = await response.json();
setEmails(data.emails);
// Only update unread count when switching to Inbox
if (newMailbox === 'INBOX') {
setUnreadCount(data.unreadCount);
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to fetch emails');
} finally {