From b45afe68a245cdbb5f7954038193550ac94c37d6 Mon Sep 17 00:00:00 2001 From: "I.K." <54219858+M00rish@users.noreply.github.com> Date: Mon, 8 Dec 2025 21:09:07 +0000 Subject: [PATCH 1/6] fix upgrade not showing --- src/pages/Search/SearchPage.tsx | 53 ++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 4c6cd65d4fa9..d6ca3301c685 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -28,6 +28,7 @@ import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; import usePersonalPolicy from '@hooks/usePersonalPolicy'; +import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses'; import usePrevious from '@hooks/usePrevious'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; @@ -72,6 +73,7 @@ import { isExpenseReport as isExpenseReportUtil, isInvoiceReport, isIOUReport as isIOUReportUtil, + isTrackExpenseReport, } from '@libs/ReportUtils'; import {buildSearchQueryJSON} from '@libs/SearchQueryUtils'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; @@ -274,6 +276,41 @@ function SearchPage({route}: SearchPageProps) { [queryJSON, selectedTransactionsKeys, areAllMatchingItemsSelected, selectedTransactionReportIDs], ); + const selectedTransactionReport = useMemo(() => { + if (!selectedTransactionsKeys.length) { + return null; + } + + const firstTransactionID = selectedTransactionsKeys.at(0); + + if (!firstTransactionID) { + return null; + } + + const transaction = selectedTransactions[firstTransactionID]; + + if (!transaction || typeof transaction !== 'object' || !('reportID' in transaction)) { + return null; + } + + return getReportOrDraftReport(transaction.reportID); + }, [selectedTransactionsKeys, selectedTransactions]); + + const iouType = useMemo(() => { + if (!selectedTransactionReport) {return CONST.IOU.TYPE.SUBMIT;} + + if (isTrackExpenseReport(selectedTransactionReport)) { + return CONST.IOU.TYPE.TRACK; + } + if (isInvoiceReport(selectedTransactionReport)) { + return CONST.IOU.TYPE.INVOICE; + } + return CONST.IOU.TYPE.SUBMIT; + }, [selectedTransactionReport]); + + const {policyForMovingExpenses, shouldSelectPolicy} = usePolicyForMovingExpenses(); + const shouldNavigateToUpgradePath = !policyForMovingExpenses && !shouldSelectPolicy; + const onBulkPaySelected = useCallback( (paymentMethod?: PaymentMethodType, additionalData?: Record) => { if (!hash) { @@ -721,7 +758,21 @@ function SearchPage({route}: SearchPageProps) { icon: expensifyIcons.DocumentMerge, value: CONST.SEARCH.BULK_ACTION_TYPES.CHANGE_REPORT, shouldCloseModalOnSelect: true, - onSelected: () => Navigation.navigate(ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP), + onSelected: () => { + if (shouldNavigateToUpgradePath && selectedTransactionsKeys.length > 0) { + Navigation.navigate( + ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ + action: CONST.IOU.ACTION.EDIT, + iouType, + transactionID: selectedTransactionsKeys.at(0), + reportID: selectedTransactions[selectedTransactionsKeys[0]].reportID, + upgradePath: CONST.UPGRADE_PATHS.REPORTS, + }), + ); + return; + } + Navigation.navigate(ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP); + }, }); } From 96c8901c90417f002ca5fccb683eba11693990df Mon Sep 17 00:00:00 2001 From: "I.K." <54219858+M00rish@users.noreply.github.com> Date: Wed, 10 Dec 2025 02:54:52 +0000 Subject: [PATCH 2/6] lint --- src/pages/Search/SearchPage.tsx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index d6ca3301c685..26449adca98f 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -277,27 +277,23 @@ function SearchPage({route}: SearchPageProps) { ); const selectedTransactionReport = useMemo(() => { - if (!selectedTransactionsKeys.length) { - return null; - } - const firstTransactionID = selectedTransactionsKeys.at(0); - if (!firstTransactionID) { return null; } - + const transaction = selectedTransactions[firstTransactionID]; - - if (!transaction || typeof transaction !== 'object' || !('reportID' in transaction)) { + if (!transaction?.reportID) { return null; } - + return getReportOrDraftReport(transaction.reportID); }, [selectedTransactionsKeys, selectedTransactions]); const iouType = useMemo(() => { - if (!selectedTransactionReport) {return CONST.IOU.TYPE.SUBMIT;} + if (!selectedTransactionReport) { + return CONST.IOU.TYPE.SUBMIT; + } if (isTrackExpenseReport(selectedTransactionReport)) { return CONST.IOU.TYPE.TRACK; @@ -760,12 +756,17 @@ function SearchPage({route}: SearchPageProps) { shouldCloseModalOnSelect: true, onSelected: () => { if (shouldNavigateToUpgradePath && selectedTransactionsKeys.length > 0) { + const firstTransactionID = selectedTransactionsKeys.at(0); + if (!firstTransactionID) { + return; + } + Navigation.navigate( ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ action: CONST.IOU.ACTION.EDIT, iouType, - transactionID: selectedTransactionsKeys.at(0), - reportID: selectedTransactions[selectedTransactionsKeys[0]].reportID, + transactionID: firstTransactionID, + reportID: selectedTransactions[firstTransactionID].reportID, upgradePath: CONST.UPGRADE_PATHS.REPORTS, }), ); @@ -849,6 +850,8 @@ function SearchPage({route}: SearchPageProps) { areAllTransactionsFromSubmitter, bulkRejectHydrationStatus, currentUserPersonalDetails?.login, + iouType, + shouldNavigateToUpgradePath, ]); const handleDeleteExpenses = () => { From 93c804db5769a7adcc8621634f95609c4f81c2b9 Mon Sep 17 00:00:00 2001 From: "I.K." <54219858+M00rish@users.noreply.github.com> Date: Tue, 16 Dec 2025 05:57:01 +0000 Subject: [PATCH 3/6] move logic to SearchTransactionsChangeReport --- src/pages/Search/SearchPage.tsx | 52 ------------------- .../Search/SearchTransactionsChangeReport.tsx | 19 +++++++ 2 files changed, 19 insertions(+), 52 deletions(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 3bc8af744b0a..5cab5b15ef2c 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -28,7 +28,6 @@ import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; import usePersonalPolicy from '@hooks/usePersonalPolicy'; -import usePolicyForMovingExpenses from '@hooks/usePolicyForMovingExpenses'; import usePrevious from '@hooks/usePrevious'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; @@ -70,7 +69,6 @@ import { isExpenseReport as isExpenseReportUtil, isInvoiceReport, isIOUReport as isIOUReportUtil, - isTrackExpenseReport, } from '@libs/ReportUtils'; import {buildSearchQueryJSON} from '@libs/SearchQueryUtils'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; @@ -225,37 +223,6 @@ function SearchPage({route}: SearchPageProps) { [queryJSON, selectedTransactionsKeys, areAllMatchingItemsSelected, selectedTransactionReportIDs], ); - const selectedTransactionReport = useMemo(() => { - const firstTransactionID = selectedTransactionsKeys.at(0); - if (!firstTransactionID) { - return null; - } - - const transaction = selectedTransactions[firstTransactionID]; - if (!transaction?.reportID) { - return null; - } - - return getReportOrDraftReport(transaction.reportID); - }, [selectedTransactionsKeys, selectedTransactions]); - - const iouType = useMemo(() => { - if (!selectedTransactionReport) { - return CONST.IOU.TYPE.SUBMIT; - } - - if (isTrackExpenseReport(selectedTransactionReport)) { - return CONST.IOU.TYPE.TRACK; - } - if (isInvoiceReport(selectedTransactionReport)) { - return CONST.IOU.TYPE.INVOICE; - } - return CONST.IOU.TYPE.SUBMIT; - }, [selectedTransactionReport]); - - const {policyForMovingExpenses, shouldSelectPolicy} = usePolicyForMovingExpenses(); - const shouldNavigateToUpgradePath = !policyForMovingExpenses && !shouldSelectPolicy; - const onBulkPaySelected = useCallback( (paymentMethod?: PaymentMethodType, additionalData?: Record) => { if (!hash) { @@ -664,23 +631,6 @@ function SearchPage({route}: SearchPageProps) { value: CONST.SEARCH.BULK_ACTION_TYPES.CHANGE_REPORT, shouldCloseModalOnSelect: true, onSelected: () => { - if (shouldNavigateToUpgradePath && selectedTransactionsKeys.length > 0) { - const firstTransactionID = selectedTransactionsKeys.at(0); - if (!firstTransactionID) { - return; - } - - Navigation.navigate( - ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ - action: CONST.IOU.ACTION.EDIT, - iouType, - transactionID: firstTransactionID, - reportID: selectedTransactions[firstTransactionID].reportID, - upgradePath: CONST.UPGRADE_PATHS.REPORTS, - }), - ); - return; - } Navigation.navigate(ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP); }, }); @@ -779,8 +729,6 @@ function SearchPage({route}: SearchPageProps) { dismissedHoldUseExplanation, dismissedRejectUseExplanation, areAllTransactionsFromSubmitter, - iouType, - shouldNavigateToUpgradePath, ]); const handleDeleteExpenses = () => { diff --git a/src/pages/Search/SearchTransactionsChangeReport.tsx b/src/pages/Search/SearchTransactionsChangeReport.tsx index 0ffb364bc9fd..ebd3c0acc204 100644 --- a/src/pages/Search/SearchTransactionsChangeReport.tsx +++ b/src/pages/Search/SearchTransactionsChangeReport.tsx @@ -118,6 +118,25 @@ function SearchTransactionsChangeReport() { }); const createReport = () => { + if (!policyForMovingExpensesID && !shouldSelectPolicy && selectedTransactionsKeys.length > 0) { + const firstTransactionID = selectedTransactionsKeys.at(0); + if (firstTransactionID) { + setNavigationActionToMicrotaskQueue(() => { + Navigation.goBack(); + Navigation.navigate( + ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ + action: CONST.IOU.ACTION.EDIT, + iouType: CONST.IOU.TYPE.SUBMIT, + transactionID: firstTransactionID, + reportID: selectedTransactions[firstTransactionID]?.reportID, + upgradePath: CONST.UPGRADE_PATHS.REPORTS, + }), + ); + }); + } + return; + } + if (shouldSelectPolicy) { Navigation.navigate(ROUTES.NEW_REPORT_WORKSPACE_SELECTION.getRoute(true)); return; From 9e29efde4c755573deda622d8a5c0ebbede41ae5 Mon Sep 17 00:00:00 2001 From: "I.K." <54219858+M00rish@users.noreply.github.com> Date: Wed, 17 Dec 2025 09:39:04 +0000 Subject: [PATCH 4/6] fix double screens --- .../Search/SearchTransactionsChangeReport.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/pages/Search/SearchTransactionsChangeReport.tsx b/src/pages/Search/SearchTransactionsChangeReport.tsx index ebd3c0acc204..5578948b8e95 100644 --- a/src/pages/Search/SearchTransactionsChangeReport.tsx +++ b/src/pages/Search/SearchTransactionsChangeReport.tsx @@ -121,18 +121,18 @@ function SearchTransactionsChangeReport() { if (!policyForMovingExpensesID && !shouldSelectPolicy && selectedTransactionsKeys.length > 0) { const firstTransactionID = selectedTransactionsKeys.at(0); if (firstTransactionID) { - setNavigationActionToMicrotaskQueue(() => { - Navigation.goBack(); - Navigation.navigate( - ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ - action: CONST.IOU.ACTION.EDIT, - iouType: CONST.IOU.TYPE.SUBMIT, - transactionID: firstTransactionID, - reportID: selectedTransactions[firstTransactionID]?.reportID, - upgradePath: CONST.UPGRADE_PATHS.REPORTS, - }), - ); - }); + // setNavigationActionToMicrotaskQueue(() => { + Navigation.navigate( + ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ + action: CONST.IOU.ACTION.EDIT, + iouType: CONST.IOU.TYPE.SUBMIT, + transactionID: firstTransactionID, + reportID: selectedTransactions[firstTransactionID]?.reportID, + upgradePath: CONST.UPGRADE_PATHS.REPORTS, + }), + {forceReplace: true}, + ); + // }); } return; } From 8d5b2d58e1bf190e41472348ffff015edc906de1 Mon Sep 17 00:00:00 2001 From: "I.K." <54219858+M00rish@users.noreply.github.com> Date: Wed, 17 Dec 2025 09:47:23 +0000 Subject: [PATCH 5/6] lint --- src/pages/Search/SearchTransactionsChangeReport.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/Search/SearchTransactionsChangeReport.tsx b/src/pages/Search/SearchTransactionsChangeReport.tsx index 5578948b8e95..7f46b14fb69a 100644 --- a/src/pages/Search/SearchTransactionsChangeReport.tsx +++ b/src/pages/Search/SearchTransactionsChangeReport.tsx @@ -121,7 +121,6 @@ function SearchTransactionsChangeReport() { if (!policyForMovingExpensesID && !shouldSelectPolicy && selectedTransactionsKeys.length > 0) { const firstTransactionID = selectedTransactionsKeys.at(0); if (firstTransactionID) { - // setNavigationActionToMicrotaskQueue(() => { Navigation.navigate( ROUTES.MONEY_REQUEST_UPGRADE.getRoute({ action: CONST.IOU.ACTION.EDIT, @@ -132,7 +131,6 @@ function SearchTransactionsChangeReport() { }), {forceReplace: true}, ); - // }); } return; } From d7a71c2e74f61519bd1b59527b99a7c04012cd24 Mon Sep 17 00:00:00 2001 From: "I.K." <54219858+M00rish@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:21:31 +0000 Subject: [PATCH 6/6] fix catch --- src/pages/Search/SearchPage.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 66dce253509e..a1dacb19f31a 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -717,9 +717,7 @@ function SearchPage({route}: SearchPageProps) { icon: expensifyIcons.DocumentMerge, value: CONST.SEARCH.BULK_ACTION_TYPES.CHANGE_REPORT, shouldCloseModalOnSelect: true, - onSelected: () => { - Navigation.navigate(ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP); - }, + onSelected: () => Navigation.navigate(ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP), }); }