Skip to content

Commit 6aa9356

Browse files
committed
add useCallback to avoid unnecessary rerenders of FloatingMessageCounter
1 parent 9293c26 commit 6aa9356

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pages/home/report/ReportActionsList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ function ReportActionsList({
493493
onScroll?.(event);
494494
};
495495

496-
const scrollToBottomAndMarkReportAsRead = () => {
496+
const scrollToBottomAndMarkReportAsRead = useCallback(() => {
497497
if (!hasNewestReportAction) {
498498
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
499499
Report.openReport(report.reportID);
@@ -503,7 +503,7 @@ function ReportActionsList({
503503
reportScrollManager.scrollToBottom();
504504
readActionSkipped.current = false;
505505
Report.readNewestAction(report.reportID);
506-
};
506+
}, [report.reportID, reportScrollManager, hasNewestReportAction]);
507507

508508
/**
509509
* Calculates the ideal number of report actions to render in the first render, based on the screen height and on

0 commit comments

Comments
 (0)