Skip to content

Commit

Permalink
fix: move the set markerLastReadTime outside the loop func
Browse files Browse the repository at this point in the history
Signed-off-by: dominictb <[email protected]>
  • Loading branch information
dominictb committed Jun 10, 2024
1 parent 5941b95 commit cc42221
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,15 @@ function ReportActionsList({
markerFound = true;
if (!currentUnreadMarker || currentUnreadMarker !== reportAction.reportActionID) {
cacheUnreadMarkers.set(report.reportID, reportAction.reportActionID);
if (!markerLastReadTimeRef.current) {
markerLastReadTimeRef.current = lastReadTimeRef.current;
}
setCurrentUnreadMarker(reportAction.reportActionID);
}
});

// if marker can be found, set the markerLastReadTimeRef to the last read time if necessary
if (markerFound && !markerLastReadTimeRef.current) {
markerLastReadTimeRef.current = lastReadTimeRef.current;
}

if (!markerFound && !linkedReportActionID) {
setCurrentUnreadMarker(null);
}
Expand Down

0 comments on commit cc42221

Please sign in to comment.