From de28fc3297d40019f1fd2eba676b5ab63e25f8f9 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Fri, 16 Jan 2026 19:15:33 +0430 Subject: [PATCH 1/3] Fix incorrect chat opening after merging expense with self DM --- src/pages/TransactionMerge/ConfirmationPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/TransactionMerge/ConfirmationPage.tsx b/src/pages/TransactionMerge/ConfirmationPage.tsx index 488edf28ff15..0e91a96674b3 100644 --- a/src/pages/TransactionMerge/ConfirmationPage.tsx +++ b/src/pages/TransactionMerge/ConfirmationPage.tsx @@ -23,6 +23,7 @@ import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTop import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; import type {MergeTransactionNavigatorParamList} from '@libs/Navigation/types'; +import {findSelfDMReportID} from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -67,7 +68,7 @@ function ConfirmationPage({route}: ConfirmationPageProps) { if (!targetTransaction || !mergeTransaction || !sourceTransaction) { return; } - const reportID = mergeTransaction.reportID; + const reportID = mergeTransaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? findSelfDMReportID() : mergeTransaction.reportID; setIsMergingExpenses(true); mergeTransactionRequest({ From d1e6e9f6ea5f4434a3fc176856b34e9167a7883b Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Sat, 17 Jan 2026 02:02:12 +0430 Subject: [PATCH 2/3] applied ai feedback. --- src/pages/TransactionMerge/ConfirmationPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/TransactionMerge/ConfirmationPage.tsx b/src/pages/TransactionMerge/ConfirmationPage.tsx index 2d05f3f440e0..759c2cdbd904 100644 --- a/src/pages/TransactionMerge/ConfirmationPage.tsx +++ b/src/pages/TransactionMerge/ConfirmationPage.tsx @@ -71,7 +71,7 @@ function ConfirmationPage({route}: ConfirmationPageProps) { if (!targetTransaction || !mergeTransaction || !sourceTransaction) { return; } - const reportID = mergeTransaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? findSelfDMReportID() : mergeTransaction.reportID; + const reportID = mergeTransaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID ? (findSelfDMReportID() ?? CONST.REPORT.UNREPORTED_REPORT_ID) : mergeTransaction.reportID; setIsMergingExpenses(true); mergeTransactionRequest({ From 9ebf64d7488430f40ba764ad5ff462b61bd2091f Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Sun, 8 Feb 2026 23:00:16 +0430 Subject: [PATCH 3/3] fixed merge expense to self-dm from search --- .../TransactionMerge/ConfirmationPage.tsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/TransactionMerge/ConfirmationPage.tsx b/src/pages/TransactionMerge/ConfirmationPage.tsx index 759c2cdbd904..79f9d8d35bbd 100644 --- a/src/pages/TransactionMerge/ConfirmationPage.tsx +++ b/src/pages/TransactionMerge/ConfirmationPage.tsx @@ -93,23 +93,23 @@ function ConfirmationPage({route}: ConfirmationPageProps) { const reportIDToDismiss = reportID !== CONST.REPORT.UNREPORTED_REPORT_ID ? reportID : undefined; - // If we're on search, dismiss the modal and stay on search - if (!isOnSearch && reportIDToDismiss && reportID !== targetTransaction.reportID) { - // Navigate to search money report screen if we're on Reports - if (isSearchTopmostFullScreenRoute()) { - // Close the current modal screen - Navigation.dismissModal(); - // Ensure the dismiss completes first - Navigation.setNavigationActionToMicrotaskQueue(() => { - // Navigate to the money request report in search results - Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID: reportIDToDismiss})); - }); - } else { - Navigation.dismissModalWithReport({reportID: reportIDToDismiss}); - } - } else { - Navigation.dismissToSuperWideRHP(); + const searchReportIDToOpen = targetTransactionThreadReportID ?? reportIDToDismiss; + + // If we're in search (or the topmost route is search), dismiss the modal and open the expense in the RHP + if ((isOnSearch || isSearchTopmostFullScreenRoute()) && searchReportIDToOpen) { + Navigation.dismissModal(); + Navigation.setNavigationActionToMicrotaskQueue(() => { + Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: searchReportIDToOpen})); + }); + return; + } + + if (reportIDToDismiss && reportID !== targetTransaction.reportID) { + Navigation.dismissModalWithReport({reportID: reportIDToDismiss}); + return; } + + Navigation.dismissToSuperWideRHP(); }; if (isLoadingOnyxValue(mergeTransactionMetadata)) {