From e615d8ed789f37cf7c49c931c1a245e15d3b3100 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 12 Apr 2024 10:43:59 +0700 Subject: [PATCH] update ref whenever rendering --- src/pages/home/report/ReportActionsList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionsList.tsx b/src/pages/home/report/ReportActionsList.tsx index 62f6dc77034d..361cedd56354 100644 --- a/src/pages/home/report/ReportActionsList.tsx +++ b/src/pages/home/report/ReportActionsList.tsx @@ -198,6 +198,7 @@ function ReportActionsList({ const reportActionSize = useRef(sortedVisibleReportActions.length); const hasNewestReportAction = sortedReportActions?.[0].created === report.lastVisibleActionCreated; const hasNewestReportActionRef = useRef(hasNewestReportAction); + hasNewestReportActionRef.current = hasNewestReportAction; const previousLastIndex = useRef(lastActionIndex); const isLastPendingActionIsDelete = sortedReportActions?.[0]?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE; @@ -226,7 +227,6 @@ function ReportActionsList({ } previousLastIndex.current = lastActionIndex; reportActionSize.current = sortedVisibleReportActions.length; - hasNewestReportActionRef.current = hasNewestReportAction; }, [lastActionIndex, sortedVisibleReportActions, reportScrollManager, hasNewestReportAction, linkedReportActionID]); useEffect(() => {