Skip to content

Commit

Permalink
Merge pull request #50110 from situchan/fix-50069
Browse files Browse the repository at this point in the history
[CP Staging] fix wrong last message in LHN after message deletion
  • Loading branch information
Beamanator authored Oct 2, 2024
2 parents c3b4a65 + b585a9d commit 312fdec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ Onyx.connect({

const firstReportAction = sortedReportActions.at(0);
if (!firstReportAction) {
return;
delete lastReportActions[reportID];
} else {
lastReportActions[reportID] = firstReportAction;
}

lastReportActions[reportID] = firstReportAction;

// The report is only visible if it is the last action not deleted that
// does not match a closed or created state.
const reportActionsForDisplay = sortedReportActions.filter(
Expand All @@ -334,6 +334,7 @@ Onyx.connect({
);
const reportActionForDisplay = reportActionsForDisplay.at(0);
if (!reportActionForDisplay) {
delete lastVisibleReportActions[reportID];
return;
}
lastVisibleReportActions[reportID] = reportActionForDisplay;
Expand Down
1 change: 1 addition & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Onyx.connect({

const reportAction = reportActionsForDisplay.at(-1);
if (!reportAction) {
delete visibleReportActionItems[reportID];
return;
}
visibleReportActionItems[reportID] = reportAction;
Expand Down

0 comments on commit 312fdec

Please sign in to comment.