From 5185906e3a8ab41dc40627c21aea1928161303f9 Mon Sep 17 00:00:00 2001 From: situchan Date: Wed, 2 Oct 2024 12:45:07 -0700 Subject: [PATCH 1/2] fix wrong last message in LHN after message deletion --- src/libs/SidebarUtils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index d00446f6da1c..0496bc66fe5b 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -51,6 +51,7 @@ Onyx.connect({ const reportAction = reportActionsForDisplay.at(-1); if (!reportAction) { + delete visibleReportActionItems[reportID]; return; } visibleReportActionItems[reportID] = reportAction; From b585a9deb256453f66f9c58d8e7bdc4ebec0934e Mon Sep 17 00:00:00 2001 From: situchan Date: Wed, 2 Oct 2024 13:17:36 -0700 Subject: [PATCH 2/2] fix more --- src/libs/OptionsListUtils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index cf0b31ef3267..90320b4a9ea1 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -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( @@ -334,6 +334,7 @@ Onyx.connect({ ); const reportActionForDisplay = reportActionsForDisplay.at(0); if (!reportActionForDisplay) { + delete lastVisibleReportActions[reportID]; return; } lastVisibleReportActions[reportID] = reportActionForDisplay;