Skip to content

Commit

Permalink
Merge pull request #39419 from bernhardoj/fix/39404-not-found-receipt…
Browse files Browse the repository at this point in the history
…-page

[CP Staging] Fix opening receipt page from IOU report leads to not found page
  • Loading branch information
NikkiWines authored Apr 3, 2024
2 parents 8300ae4 + b101c09 commit 935df86
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/TransactionReceiptPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ function TransactionReceipt({transaction, report, reportMetadata = {isLoadingIni
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const moneyRequestReportID = ReportUtils.isMoneyRequestReport(report) ? report?.reportID : report?.parentReportID;
const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report);

// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFoundPage = isTrackExpenseReport ? !transaction : (moneyRequestReportID ?? '') !== transaction?.reportID;

return (
<AttachmentModal
source={imageSource}
Expand All @@ -59,7 +65,7 @@ function TransactionReceipt({transaction, report, reportMetadata = {isLoadingIni
Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report?.reportID ?? ''));
}}
isLoading={!transaction && reportMetadata?.isLoadingInitialReportActions}
shouldShowNotFoundPage={(report?.parentReportID ?? '') !== transaction?.reportID}
shouldShowNotFoundPage={shouldShowNotFoundPage}
/>
);
}
Expand Down

0 comments on commit 935df86

Please sign in to comment.