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; 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;