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