Neah version mail remove mail correction 4

This commit is contained in:
alma 2025-04-16 20:47:43 +02:00
parent 542280b65b
commit 61d4f19875

View File

@ -1550,9 +1550,17 @@ export default function MailPage() {
}
const data = await response.json();
setEmails(data.emails);
// Only update unread count if we're in the Inbox
// Only update unread count when switching to Inbox
if (newMailbox === 'INBOX') {
setUnreadCount(data.unreadCount);
} else {
// Keep the existing unread count when switching to other folders
const inboxResponse = await fetch('/api/mail?folder=INBOX');
if (inboxResponse.ok) {
const inboxData = await inboxResponse.json();
setUnreadCount(inboxData.unreadCount);
}
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to fetch emails');