From cf994f46e4d40b9ab1a14dff1f7eee05a85584ad Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Wed, 5 Apr 2023 23:34:22 +0530 Subject: [PATCH] TP-22455 | notification fixes (#213) --- src/reducer/notificationsSlice.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/reducer/notificationsSlice.ts b/src/reducer/notificationsSlice.ts index 6a3c82a8..4ec05d1c 100644 --- a/src/reducer/notificationsSlice.ts +++ b/src/reducer/notificationsSlice.ts @@ -91,12 +91,14 @@ const NotificationsSlice = createSlice({ }, addActionToNotifications: (state, action) => { const actionPayload = action.payload; + let readNotificationCount = 0; actionPayload.forEach((action: INotificationAction) => { const { id } = action; const index = state.data.findIndex( notification => notification.id === id, ); if (index !== -1) { + readNotificationCount++; state.data[index].actions = [ { widgetStatus: WidgetStatus.CLICKED, @@ -104,6 +106,7 @@ const NotificationsSlice = createSlice({ ]; } }); + state.totalUnreadElements = state.totalUnreadElements - readNotificationCount; state.notificationsWithActions = []; }, setNotificationsLoading: (state, action) => {