Skip to content

Commit

Permalink
code simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
burczu committed May 23, 2024
1 parent 14a3f22 commit 6dfb6fd
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,8 @@ function ReportActionsList({
[sortedReportActions, isOffline],
);

const newestVisibleReportAction = useMemo(() => {
// whisper action doesn't affect lastVisibleActionCreated, so we should not take it into account while checking if there is the newest report action
let index = 0;
const size = sortedVisibleReportActions.length;
while (index < size) {
if (!ReportActionsUtils.isWhisperAction(sortedVisibleReportActions[index])) {
return sortedVisibleReportActions[index];
}
index += 1;
}

return null;
}, [sortedVisibleReportActions]);
// whisper action doesn't affect lastVisibleActionCreated, so we should not take it into account while checking if there is the newest report action
const newestVisibleReportAction = useMemo(() => sortedVisibleReportActions.find((item) => !ReportActionsUtils.isWhisperAction(item)) ?? null, [sortedVisibleReportActions]);

const lastActionIndex = sortedVisibleReportActions[0]?.reportActionID;
const reportActionSize = useRef(sortedVisibleReportActions.length);
Expand Down

0 comments on commit 6dfb6fd

Please sign in to comment.