From 8bde6bbcc07c6e31656aab298b9a689e5ef6ce63 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 3 Apr 2024 00:09:27 +0800 Subject: [PATCH 1/4] get the correct report ID --- src/pages/TransactionReceiptPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/TransactionReceiptPage.tsx b/src/pages/TransactionReceiptPage.tsx index f6f2c90e5d2c..0d0ed7da9df6 100644 --- a/src/pages/TransactionReceiptPage.tsx +++ b/src/pages/TransactionReceiptPage.tsx @@ -45,6 +45,8 @@ function TransactionReceipt({transaction, report, reportMetadata = {isLoadingIni // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + const moneyRequestReportID = ReportUtils.isMoneyRequestReport(report) ? report?.reportID : report?.parentReportID; + return ( ); } From 99a31ffa49f666f6e66380087222dbe8ce49ae05 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 3 Apr 2024 00:38:26 +0800 Subject: [PATCH 2/4] don't show not found page for track expense report --- src/pages/TransactionReceiptPage.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/TransactionReceiptPage.tsx b/src/pages/TransactionReceiptPage.tsx index 0d0ed7da9df6..fb4a85acd6c5 100644 --- a/src/pages/TransactionReceiptPage.tsx +++ b/src/pages/TransactionReceiptPage.tsx @@ -46,6 +46,9 @@ function TransactionReceipt({transaction, report, reportMetadata = {isLoadingIni }, []); const moneyRequestReportID = ReportUtils.isMoneyRequestReport(report) ? report?.reportID : report?.parentReportID; + const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report); + + const shouldShowNotFoundPage = !isTrackExpenseReport && (moneyRequestReportID ?? '') !== transaction?.reportID; return ( ); } From 3b474dfb5dbfaa9ae54bb3b5dd1586f76186fd3d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 3 Apr 2024 00:44:03 +0800 Subject: [PATCH 3/4] improve the not found page condition --- src/pages/TransactionReceiptPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/TransactionReceiptPage.tsx b/src/pages/TransactionReceiptPage.tsx index fb4a85acd6c5..499212e6ae61 100644 --- a/src/pages/TransactionReceiptPage.tsx +++ b/src/pages/TransactionReceiptPage.tsx @@ -48,7 +48,7 @@ function TransactionReceipt({transaction, report, reportMetadata = {isLoadingIni const moneyRequestReportID = ReportUtils.isMoneyRequestReport(report) ? report?.reportID : report?.parentReportID; const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report); - const shouldShowNotFoundPage = !isTrackExpenseReport && (moneyRequestReportID ?? '') !== transaction?.reportID; + const shouldShowNotFoundPage = isTrackExpenseReport ? !transaction : (moneyRequestReportID ?? '') !== transaction?.reportID; return ( Date: Wed, 3 Apr 2024 00:51:03 +0800 Subject: [PATCH 4/4] supress lint --- src/pages/TransactionReceiptPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/TransactionReceiptPage.tsx b/src/pages/TransactionReceiptPage.tsx index 499212e6ae61..80bda8c0df1b 100644 --- a/src/pages/TransactionReceiptPage.tsx +++ b/src/pages/TransactionReceiptPage.tsx @@ -48,6 +48,7 @@ function TransactionReceipt({transaction, report, reportMetadata = {isLoadingIni 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 (