Skip to content

Commit

Permalink
fix two divider display for a second
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed Aug 18, 2023
1 parent c435734 commit 5e5c397
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ function isMessageUnread(message, lastReadTime) {
return Boolean(message && lastReadTime && message.created && lastReadTime < message.created);
}

function getFirstActionVisible(sortedReportActions, isOffline) {
const sortedFilterReportActions = sortedReportActions.filter((action) => !ReportActionsUtils.isDeletedAction(action) || action.childVisibleActionCount > 0 || isOffline);
console.log(sortedFilterReportActions);
return sortedFilterReportActions.length > 1 ? sortedFilterReportActions[sortedFilterReportActions.length - 2] : null;
}

function ReportActionsList({
report,
sortedReportActions,
Expand All @@ -113,6 +119,7 @@ function ReportActionsList({
const scrollingVerticalOffset = useRef(0);
const readActionSkipped = useRef(false);
const reportActionSize = useRef(sortedReportActions.length);
const firstVisibleAction = getFirstActionVisible(sortedReportActions, isOffline);

// Considering that renderItem is enclosed within a useCallback, marking it as "read" twice will retain the value as "true," preventing the useCallback from re-executing.
// However, if we create and listen to an object, it will lead to a new useCallback execution.
Expand Down Expand Up @@ -246,7 +253,8 @@ function ReportActionsList({
reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED &&
ReportUtils.isChatThread(report) &&
!ReportActionsUtils.isTransactionThread(ReportActionsUtils.getParentReportAction(report));
const shouldHideThreadDividerLine = sortedReportActions.length > 1 && sortedReportActions[sortedReportActions.length - 2].reportActionID === currentUnreadMarker.current;
console.log(currentUnreadMarker.current);
const shouldHideThreadDividerLine = !!firstVisibleAction && firstVisibleAction.reportActionID === currentUnreadMarker.current;

return shouldDisplayParentAction ? (
<ReportActionItemParentAction
Expand Down

0 comments on commit 5e5c397

Please sign in to comment.