From 50f22be3563fdfa5fef59ac3b82cce5bbea2a753 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Fri, 27 Oct 2023 03:15:53 -0500 Subject: [PATCH] fix: set null to unread marker when there are no new messages --- src/pages/home/report/ReportActionsList.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/home/report/ReportActionsList.js b/src/pages/home/report/ReportActionsList.js index 300b1921545d..de932d5b93a3 100644 --- a/src/pages/home/report/ReportActionsList.js +++ b/src/pages/home/report/ReportActionsList.js @@ -319,14 +319,19 @@ function ReportActionsList({ // Iterate through the report actions and set appropriate unread marker. // This is to avoid a warning of: // Cannot update a component (ReportActionsList) while rendering a different component (CellRenderer). + let markerFound = false; _.each(sortedReportActions, (reportAction, index) => { if (!shouldDisplayNewMarker(reportAction, index)) { return; } + markerFound = true; if (!currentUnreadMarker && currentUnreadMarker !== reportAction.reportActionID) { setCurrentUnreadMarker(reportAction.reportActionID); } }); + if (!markerFound) { + setCurrentUnreadMarker(null); + } }, [sortedReportActions, report.lastReadTime, messageManuallyMarkedUnread, shouldDisplayNewMarker, currentUnreadMarker]); const renderItem = useCallback(