Skip to content

Commit

Permalink
Fix one-expense report loading
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyStash committed Oct 3, 2024
1 parent 69066f8 commit 2df50c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2df50c5

Please sign in to comment.