fix: Update total notification count only when the 'all' filter is active to prevent incorrect overwrites.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user