Skip to content

Commit

Permalink
update ref whenever rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Apr 12, 2024
1 parent d0d0049 commit e615d8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -226,7 +227,6 @@ function ReportActionsList({
}
previousLastIndex.current = lastActionIndex;
reportActionSize.current = sortedVisibleReportActions.length;
hasNewestReportActionRef.current = hasNewestReportAction;
}, [lastActionIndex, sortedVisibleReportActions, reportScrollManager, hasNewestReportAction, linkedReportActionID]);

useEffect(() => {
Expand Down

0 comments on commit e615d8e

Please sign in to comment.