fix: Update total notification count only when the 'all' filter is active to prevent incorrect overwrites.

This commit is contained in:
pradeepkumar
2026-03-19 16:25:10 +05:30
parent 6aa4b62df3
commit 94b7577234
2 changed files with 8 additions and 2 deletions

View File

@@ -49,7 +49,11 @@ export default function AgentNotificationsPage() {
const data = await notificationsApiService.getNotifications(filter, 1, 50);
setNotifications(data.notifications);
setUnreadCount(data.unreadCount);
// Only update totalCount from the 'all' filter, otherwise it gets overwritten
// with the unread count when switching tabs
if (filter === 'all') {
setTotalCount(data.pagination.total);
}
} catch (err) {
console.error('Failed to fetch notifications:', err);
} finally {

View File

@@ -47,7 +47,9 @@ export default function UserNotificationsPage() {
const data = await notificationsApiService.getNotifications(filter, 1, 50);
setNotifications(data.notifications);
setUnreadCount(data.unreadCount);
if (filter === 'all') {
setTotalCount(data.pagination.total);
}
} catch (err) {
console.error('Failed to fetch notifications:', err);
} finally {