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) => {