From d7420d68c44e98ab01f8bcc0c7fec7f8b5ff6348 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Tue, 30 Apr 2024 13:48:26 +0530
Subject: [PATCH 01/10] Show error message with thread

---
 .../ReportActionItem/MoneyRequestView.tsx     | 44 +++++++++++--------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index a26c368ae170..487226a4da00 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -336,6 +336,12 @@ function MoneyRequestView({
     const noticeTypeViolations = transactionViolations?.filter((violation) => violation.type === 'notice').map((v) => ViolationsUtils.getViolationTranslation(v, translate)) ?? [];
     const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);
 
+    const errors = {...(transaction?.errors ?? {})};
+    if (parentReportAction?.errors) {
+        // Merging parentReportAction.errors into errors
+        Object.assign(errors, parentReportAction.errors);
+    }
+
     return (
         <View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true, shouldShowAnimatedBackground)]}>
             {shouldShowAnimatedBackground && <AnimatedEmptyStateBackground />}
@@ -344,10 +350,10 @@ function MoneyRequestView({
                     notes={noticeTypeViolations}
                     shouldShowAuditMessage={Boolean(shouldShowNotesViolations && didRceiptScanSucceed)}
                 />
-                {shouldShowMapOrReceipt && (
+                {(shouldShowMapOrReceipt || errors) && (
                     <OfflineWithFeedback
                         pendingAction={pendingAction}
-                        errors={transaction?.errors}
+                        errors={errors}
                         errorRowStyles={[styles.ml4]}
                         onClose={() => {
                             if (!transaction?.transactionID) {
@@ -356,22 +362,24 @@ function MoneyRequestView({
                             Transaction.clearError(transaction.transactionID);
                         }}
                     >
-                        <View style={styles.moneyRequestViewImage}>
-                            {showMapAsImage ? (
-                                <ConfirmedRoute transaction={transaction} />
-                            ) : (
-                                <ReportActionItemImage
-                                    thumbnail={receiptURIs?.thumbnail}
-                                    fileExtension={receiptURIs?.fileExtension}
-                                    isThumbnail={receiptURIs?.isThumbnail}
-                                    image={receiptURIs?.image}
-                                    isLocalFile={receiptURIs?.isLocalFile}
-                                    filename={receiptURIs?.filename}
-                                    transaction={transaction}
-                                    enablePreviewModal
-                                />
-                            )}
-                        </View>
+                        {shouldShowMapOrReceipt && (
+                            <View style={styles.moneyRequestViewImage}>
+                                {showMapAsImage ? (
+                                    <ConfirmedRoute transaction={transaction} />
+                                ) : (
+                                    <ReportActionItemImage
+                                        thumbnail={receiptURIs?.thumbnail}
+                                        fileExtension={receiptURIs?.fileExtension}
+                                        isThumbnail={receiptURIs?.isThumbnail}
+                                        image={receiptURIs?.image}
+                                        isLocalFile={receiptURIs?.isLocalFile}
+                                        filename={receiptURIs?.filename}
+                                        transaction={transaction}
+                                        enablePreviewModal
+                                    />
+                                )}
+                            </View>
+                        )}
                     </OfflineWithFeedback>
                 )}
                 {shouldShowReceiptEmptyState && (

From b44cab3f749512899bb550a567e00630382f14e9 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Thu, 2 May 2024 13:20:33 +0530
Subject: [PATCH 02/10] Combine Assignment

---
 package-lock.json                                    | 2 +-
 src/components/ReportActionItem/MoneyRequestView.tsx | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 5962d3b29504..e57869f5c63b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -100,7 +100,7 @@
         "react-native-linear-gradient": "^2.8.1",
         "react-native-localize": "^2.2.6",
         "react-native-modal": "^13.0.0",
-        "react-native-onyx": "^2.0.35",
+        "react-native-onyx": "2.0.35",
         "react-native-pager-view": "6.2.3",
         "react-native-pdf": "6.7.3",
         "react-native-performance": "^5.1.0",
diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index c97d88f9ceab..f0c8485fa632 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -332,11 +332,10 @@ function MoneyRequestView({
     const noticeTypeViolations = transactionViolations?.filter((violation) => violation.type === 'notice').map((v) => ViolationsUtils.getViolationTranslation(v, translate)) ?? [];
     const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);
 
-    const errors = {...(transaction?.errors ?? {})};
-    if (parentReportAction?.errors) {
-        // Merging parentReportAction.errors into errors
-        Object.assign(errors, parentReportAction.errors);
-    }
+    const errors = {
+        ...(transaction?.errors ?? {}),
+        ...(parentReportAction?.errors ?? {})
+    };
 
     return (
         <View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true, shouldShowAnimatedBackground)]}>

From 3a38ae571816bfb478ced784ee68c6c0b966d0a4 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Thu, 2 May 2024 13:23:07 +0530
Subject: [PATCH 03/10] Combine Assignment

---
 package-lock.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package-lock.json b/package-lock.json
index e57869f5c63b..5962d3b29504 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -100,7 +100,7 @@
         "react-native-linear-gradient": "^2.8.1",
         "react-native-localize": "^2.2.6",
         "react-native-modal": "^13.0.0",
-        "react-native-onyx": "2.0.35",
+        "react-native-onyx": "^2.0.35",
         "react-native-pager-view": "6.2.3",
         "react-native-pdf": "6.7.3",
         "react-native-performance": "^5.1.0",

From b5f47c0dca42e12cac67cee8105357f2acf5a3d5 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Thu, 2 May 2024 13:35:31 +0530
Subject: [PATCH 04/10] Solved Lint Error

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index f0c8485fa632..c5a949b586a5 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -334,7 +334,7 @@ function MoneyRequestView({
 
     const errors = {
         ...(transaction?.errors ?? {}),
-        ...(parentReportAction?.errors ?? {})
+        ...(parentReportAction?.errors ?? {}),
     };
 
     return (

From d99ad12df73e06a0e8f1142a7855339cfd6b570c Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Tue, 14 May 2024 13:37:37 +0530
Subject: [PATCH 05/10] show error message with thred

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index b9296d0da104..46f0d8ef70a6 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -340,7 +340,7 @@ function MoneyRequestView({
                 {(shouldShowMapOrReceipt || errors) && (
                     <OfflineWithFeedback
                         pendingAction={pendingAction}
-                        errors={transaction?.errors}
+                        errors={errors}
                         errorRowStyles={[styles.mh4]}
                         onClose={() => {
                             if (!transaction?.transactionID) {

From 404e2b95d6701ebe20e23f96a6706196d198b359 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Tue, 14 May 2024 15:43:55 +0530
Subject: [PATCH 06/10] show error message with thread

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index 46f0d8ef70a6..f47b576c5846 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -323,9 +323,9 @@ function MoneyRequestView({
     const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);
 
     const errors = {
-        ...(transaction?.errors ?? {}),
-        ...(parentReportAction?.errors ?? {}),
-    };
+        ...transaction?.errors,
+        ...parentReportAction?.errors
+    }
 
     return (
         <View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true, shouldShowAnimatedBackground)]}>

From 9f6b46292ba6ee9169cbf683fba0fdc2d443f7fd Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Tue, 14 May 2024 15:51:30 +0530
Subject: [PATCH 07/10] show error message with thread

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index f47b576c5846..3c2333e114ed 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -324,8 +324,8 @@ function MoneyRequestView({
 
     const errors = {
         ...transaction?.errors,
-        ...parentReportAction?.errors
-    }
+        ...parentReportAction?.errors,
+    };
 
     return (
         <View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true, shouldShowAnimatedBackground)]}>

From 93fcd222f5d006a3425bd183fba41618560e9c23 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Fri, 17 May 2024 11:07:07 +0530
Subject: [PATCH 08/10] Resolve merge conflict in MoneyRequestView.tsx

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index 1b0ba73dd812..356b533afa59 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -323,7 +323,7 @@ function MoneyRequestView({
     const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);
 
     const errors = {
-        ...transaction?.errors,
+        ...transaction?.errorFields?.route ?? transaction?.errors,
         ...parentReportAction?.errors,
     };
 
@@ -340,7 +340,7 @@ function MoneyRequestView({
                 {(shouldShowMapOrReceipt || errors) && (
                     <OfflineWithFeedback
                         pendingAction={pendingAction}
-                        errors={transaction?.errorFields?.route ?? transaction?.errors}
+                        errors={errors}
                         errorRowStyles={[styles.mh4]}
                         onClose={() => {
                             if (!transaction?.transactionID) {

From f2897f4f17f370ddb69c14b05143c00f1f0687f7 Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Fri, 17 May 2024 11:09:43 +0530
Subject: [PATCH 09/10] Resolve merge conflict in MoneyRequestView.tsx

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index 356b533afa59..d365c16df801 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -323,7 +323,7 @@ function MoneyRequestView({
     const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);
 
     const errors = {
-        ...transaction?.errorFields?.route ?? transaction?.errors,
+        ...(transaction?.errorFields?.route ?? transaction?.errors),
         ...parentReportAction?.errors,
     };
 

From e1e196d9c4a5ff9e58d5160d8803502d428f1c2c Mon Sep 17 00:00:00 2001
From: Kaushik Kapadiya <kapadiyakaushik9@gmail.com>
Date: Thu, 23 May 2024 13:42:26 +0530
Subject: [PATCH 10/10] Resolve

---
 src/components/ReportActionItem/MoneyRequestView.tsx | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx
index d365c16df801..7ed4cd55e97f 100644
--- a/src/components/ReportActionItem/MoneyRequestView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestView.tsx
@@ -38,6 +38,7 @@ import * as IOU from '@userActions/IOU';
 import * as Transaction from '@userActions/Transaction';
 import CONST from '@src/CONST';
 import type {TranslationPaths} from '@src/languages/types';
+import * as ReportActions from '@src/libs/actions/ReportActions';
 import ONYXKEYS from '@src/ONYXKEYS';
 import ROUTES from '@src/ROUTES';
 import type * as OnyxTypes from '@src/types/onyx';
@@ -347,6 +348,7 @@ function MoneyRequestView({
                                 return;
                             }
                             Transaction.clearError(transaction.transactionID);
+                            ReportActions.clearAllRelatedReportActionErrors(report.reportID, parentReportAction);
                         }}
                     >
                         {shouldShowMapOrReceipt && (
