From 2df50c5041c5985b5c0c4f248305cd3559fada34 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Thu, 3 Oct 2024 15:19:52 +0200 Subject: [PATCH] Fix one-expense report loading --- src/pages/home/ReportScreen.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index dd38a0716377..8a12d983790b 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -687,8 +687,14 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro Report.readNewestAction(report?.reportID ?? ''); }, [report]); const mostRecentReportAction = reportActions.at(0); + const isMostRecentReportIOU = mostRecentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU; + const isSingleIOUReportAction = reportActions.filter((action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU).length === 1; + const isSingleExpenseReport = ReportUtils.isExpenseReport(report) && isMostRecentReportIOU && isSingleIOUReportAction; + const isSingleInvoiceReport = ReportUtils.isInvoiceReport(report) && isMostRecentReportIOU && isSingleIOUReportAction; const shouldShowMostRecentReportAction = !!mostRecentReportAction && + !isSingleExpenseReport && + !isSingleInvoiceReport && !ReportActionsUtils.isActionOfType(mostRecentReportAction, CONST.REPORT.ACTIONS.TYPE.CREATED) && !ReportActionsUtils.isDeletedAction(mostRecentReportAction);