From 2173232f673d921150e5dbbf8a2d1979975b0308 Mon Sep 17 00:00:00 2001 From: alma Date: Wed, 16 Apr 2025 20:52:08 +0200 Subject: [PATCH] Neah version mail remove mail correction 6 --- app/mail/page.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/mail/page.tsx b/app/mail/page.tsx index 33f8682..f09ca36 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -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 {