From c81490ad6f7f3e89ca06fad817070acc3061c5ec Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 3 Jul 2024 12:48:12 +0700 Subject: [PATCH 1/6] fix: List still shows receipt when removed --- src/libs/actions/IOU.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 48c70021cacc..ce7a1d128011 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6631,7 +6631,15 @@ function payInvoice(paymentMethodType: PaymentMethodType, chatReport: OnyxTypes. function detachReceipt(transactionID: string) { const transaction = allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]; - const newTransaction = transaction ? {...transaction, filename: '', receipt: {}} : null; + const newTransaction = transaction + ? { + ...transaction, + filename: '', + receipt: { + source: '', + }, + } + : null; const optimisticData: OnyxUpdate[] = [ { From 5e61328af4efd4ea589acc5c54b0ddd89abcb2c5 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 16 Jul 2024 11:04:38 +0700 Subject: [PATCH 2/6] fix offline case --- src/libs/actions/IOU.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 06346f23b716..6ea44619914f 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6773,9 +6773,7 @@ function detachReceipt(transactionID: string) { ? { ...transaction, filename: '', - receipt: { - source: '', - }, + receipt: null, } : null; From ef7e8828f76ae1e8e576f34e2bf5afba3caad1b2 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 23 Jul 2024 10:20:01 +0700 Subject: [PATCH 3/6] fix receipt is displayed after deleting --- src/CONFIG.ts | 2 +- src/libs/actions/Search.ts | 1 + src/pages/home/ReportScreen.tsx | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/CONFIG.ts b/src/CONFIG.ts index 8800cc907588..ec7f4b39af91 100644 --- a/src/CONFIG.ts +++ b/src/CONFIG.ts @@ -96,5 +96,5 @@ export default { IOS_CLIENT_ID: '921154746561-s3uqn2oe4m85tufi6mqflbfbuajrm2i3.apps.googleusercontent.com', }, GCP_GEOLOCATION_API_KEY: googleGeolocationAPIKey, - USE_REACT_STRICT_MODE: true, + USE_REACT_STRICT_MODE: false, } as const; diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 969812b02b02..caa7bb3e09b2 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -58,6 +58,7 @@ function search({hash, query, policyIDs, offset, sortBy, sortOrder}: SearchParam * In that case, when users select the search result row, we need to create the transaction thread on the fly and update the search result with the new transactionThreadReport */ function createTransactionThread(hash: number, transactionID: string, reportID: string, moneyRequestReportActionID: string) { + console.log('anss'); Report.openReport(reportID, '', [currentUserEmail], undefined, moneyRequestReportActionID); const onyxUpdate: Record>> = { diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 6535d35c55f9..945e6570fab8 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -558,7 +558,14 @@ function ReportScreen({ // If a user has chosen to leave a thread, and then returns to it (e.g. with the back button), we need to call `openReport` again in order to allow the user to rejoin and to receive real-time updates useEffect(() => { - if (!shouldUseNarrowLayout || !isFocused || prevIsFocused || !ReportUtils.isChatThread(report) || report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { + if ( + !shouldUseNarrowLayout || + !isFocused || + prevIsFocused || + !ReportUtils.isChatThread(report) || + report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN || + isSingleTransactionView + ) { return; } Report.openReport(report.reportID); @@ -566,7 +573,7 @@ function ReportScreen({ // We don't want to run this useEffect every time `report` is changed // Excluding shouldUseNarrowLayout from the dependency list to prevent re-triggering on screen resize events. // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [prevIsFocused, report.notificationPreference, isFocused]); + }, [prevIsFocused, report.notificationPreference, isFocused, isSingleTransactionView]); useEffect(() => { // We don't want this effect to run on the first render. From 812dd217bfaf4ea955e7ebecbbaa4ba6dbb664ac Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 23 Jul 2024 10:24:36 +0700 Subject: [PATCH 4/6] revert unnecessary change --- src/CONFIG.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CONFIG.ts b/src/CONFIG.ts index ec7f4b39af91..8800cc907588 100644 --- a/src/CONFIG.ts +++ b/src/CONFIG.ts @@ -96,5 +96,5 @@ export default { IOS_CLIENT_ID: '921154746561-s3uqn2oe4m85tufi6mqflbfbuajrm2i3.apps.googleusercontent.com', }, GCP_GEOLOCATION_API_KEY: googleGeolocationAPIKey, - USE_REACT_STRICT_MODE: false, + USE_REACT_STRICT_MODE: true, } as const; From f07f5cf2cffebe90095195b65ca982c383d548b9 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 23 Jul 2024 10:41:42 +0700 Subject: [PATCH 5/6] fix lint --- src/libs/actions/Search.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index caa7bb3e09b2..969812b02b02 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -58,7 +58,6 @@ function search({hash, query, policyIDs, offset, sortBy, sortOrder}: SearchParam * In that case, when users select the search result row, we need to create the transaction thread on the fly and update the search result with the new transactionThreadReport */ function createTransactionThread(hash: number, transactionID: string, reportID: string, moneyRequestReportActionID: string) { - console.log('anss'); Report.openReport(reportID, '', [currentUserEmail], undefined, moneyRequestReportActionID); const onyxUpdate: Record>> = { From dcea2f9e2f82988993a811fc849cb93eae1ed9ff Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 26 Jul 2024 13:38:46 +0700 Subject: [PATCH 6/6] fix bug when adding receipt again --- src/libs/actions/IOU.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 4c2ee94dabb1..429b3a9cb34f 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7219,7 +7219,9 @@ function detachReceipt(transactionID: string) { ? { ...transaction, filename: '', - receipt: null, + receipt: { + source: '', + }, } : null;