From 5b4d99d7f6cf7b3baa64cfc1228779d4a9939925 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Fri, 20 Feb 2026 15:39:21 +0430 Subject: [PATCH 1/6] fix(reports): prevent RHP from closing when opening expense details --- src/components/Search/index.tsx | 8 ++++++-- .../Search/TransactionGroupListExpanded.tsx | 8 +++++++- .../Search/TransactionGroupListItem.tsx | 1 + src/components/SelectionListWithSections/types.ts | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 876c8b137cc6a..7fbf162ebe91b 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -475,7 +475,10 @@ function Search({ return []; } return (baseFilteredData as TransactionGroupListItemType[]) - .map((item) => (item.transactionsQueryJSON?.hash ? String(item.transactionsQueryJSON.hash) : undefined)) + .map((item) => { + const queryHash = item.transactionsQueryJSON?.hash; + return queryHash || queryHash === 0 ? String(queryHash) : undefined; + }) .filter((hashValue): hashValue is string => !!hashValue); }, [validGroupBy, baseFilteredData]); @@ -487,7 +490,8 @@ function Search({ } const enriched = (baseFilteredData as TransactionGroupListItemType[]).map((item) => { - const snapshot = item.transactionsQueryJSON?.hash ? groupByTransactionSnapshots[String(item.transactionsQueryJSON.hash)] : undefined; + const queryHash = item.transactionsQueryJSON?.hash; + const snapshot = queryHash || queryHash === 0 ? groupByTransactionSnapshots[String(queryHash)] : undefined; if (!snapshot?.data) { return item; } diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx index 21dd1549a7d75..ea8dcb159159a 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx @@ -32,6 +32,7 @@ function TransactionGroupListExpanded({ showTooltip, canSelectMultiple, onCheckboxPress, + onSelectRow, columns, groupBy, accountID, @@ -103,7 +104,12 @@ function TransactionGroupListExpanded({ // The arrow navigation in RHP is only allowed for group-by:reports if (!isExpenseReportType) { - navigateToTransactionThread(); + onSelectRow(transactionItem as unknown as TItem, { + hasParentReport: false, + hasTransaction: false, + hasParentReportAction: false, + hasTransactionThreadReport: false, + }); return; } diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx index 674bc0cf974f5..669e7db05f812 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx @@ -546,6 +546,7 @@ function TransactionGroupListItem({ showTooltip={showTooltip} canSelectMultiple={canSelectMultiple} onCheckboxPress={onCheckboxPress} + onSelectRow={onSelectRow} columns={columns} groupBy={groupBy} accountID={currentUserDetails.accountID} diff --git a/src/components/SelectionListWithSections/types.ts b/src/components/SelectionListWithSections/types.ts index 03ecfb999f286..e185cb484960f 100644 --- a/src/components/SelectionListWithSections/types.ts +++ b/src/components/SelectionListWithSections/types.ts @@ -712,7 +712,7 @@ type TransactionGroupListItemProps = ListItemProps = Pick< TransactionGroupListItemProps, - 'showTooltip' | 'canSelectMultiple' | 'onCheckboxPress' | 'columns' | 'groupBy' | 'accountID' | 'isOffline' | 'violations' + 'showTooltip' | 'canSelectMultiple' | 'onCheckboxPress' | 'onSelectRow' | 'columns' | 'groupBy' | 'accountID' | 'isOffline' | 'violations' > & { transactions: TransactionListItemType[]; transactionsVisibleLimit: number; From 16117a088d057be68b8a512328664f8c00774804 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 24 Feb 2026 16:42:57 +0430 Subject: [PATCH 2/6] refactor: created helper hashToString --- src/components/Search/index.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index fc2bc1d198802..13496496f1427 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -98,6 +98,8 @@ type SearchProps = { onDEWModalOpen?: () => void; }; +const hashToString = (queryHash?: number) => (queryHash || queryHash === 0 ? String(queryHash) : undefined); + function mapTransactionItemToSelectedEntry( item: TransactionListItemType, itemTransaction: OnyxEntry, @@ -474,10 +476,7 @@ function Search({ return []; } return (baseFilteredData as TransactionGroupListItemType[]) - .map((item) => { - const queryHash = item.transactionsQueryJSON?.hash; - return queryHash || queryHash === 0 ? String(queryHash) : undefined; - }) + .map((item) => hashToString(item.transactionsQueryJSON?.hash)) .filter((hashValue): hashValue is string => !!hashValue); }, [validGroupBy, baseFilteredData]); @@ -489,8 +488,7 @@ function Search({ } const enriched = (baseFilteredData as TransactionGroupListItemType[]).map((item) => { - const queryHash = item.transactionsQueryJSON?.hash; - const snapshot = queryHash || queryHash === 0 ? groupByTransactionSnapshots[String(queryHash)] : undefined; + const snapshot = groupByTransactionSnapshots[hashToString(item.transactionsQueryJSON?.hash) ?? '']; if (!snapshot?.data) { return item; } From 6a4f03a4acea20d8e322a4197e003f044a396b3d Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 24 Feb 2026 16:49:38 +0430 Subject: [PATCH 3/6] fix(search): avoid hardcoded preview flags for grouped row open flow --- .../Search/TransactionGroupListExpanded.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx index 5f37d9fb031d7..07b009215f131 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx @@ -19,8 +19,11 @@ import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import {getReportIDForTransaction} from '@libs/MoneyRequestReportUtils'; import Navigation from '@libs/Navigation/Navigation'; +import {getReportAction} from '@libs/ReportActionsUtils'; +import {getReportOrDraftReport} from '@libs/ReportUtils'; import {createAndOpenSearchTransactionThread, getColumnsToShow, getTableMinWidth} from '@libs/SearchUIUtils'; import {getTransactionViolations} from '@libs/TransactionUtils'; +import type {TransactionPreviewData} from '@userActions/Search'; import {setActiveTransactionIDs} from '@userActions/TransactionThreadNavigation'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -89,6 +92,20 @@ function TransactionGroupListExpanded({ const dateColumnSize = shouldShowYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL; const {markReportIDAsExpense} = useWideRHPActions(); + const selectRow = onSelectRow as (item: TItem, transactionPreviewData?: TransactionPreviewData) => void; + const getTransactionPreviewData = (transactionItem: TransactionListItemType): TransactionPreviewData => { + const parentReportAction = getReportAction(transactionItem?.reportID, transactionItem?.reportAction?.reportActionID); + const parentReport = getReportOrDraftReport(transactionItem?.reportID); + const transactionThreadReport = getReportOrDraftReport(transactionItem?.reportAction?.childReportID); + + return { + hasParentReport: !!parentReport, + hasTransaction: false, + hasParentReportAction: !!parentReportAction || !!transactionItem.reportAction, + hasTransactionThreadReport: !!transactionThreadReport, + }; + }; + const openReportInRHP = (transactionItem: TransactionListItemType) => { const backTo = Navigation.getActiveRoute(); const reportID = getReportIDForTransaction(transactionItem, transactionItem?.reportAction?.childReportID); @@ -104,12 +121,7 @@ function TransactionGroupListExpanded({ // The arrow navigation in RHP is only allowed for group-by:reports if (!isExpenseReportType) { - onSelectRow(transactionItem as unknown as TItem, { - hasParentReport: false, - hasTransaction: false, - hasParentReportAction: false, - hasTransactionThreadReport: false, - }); + selectRow(transactionItem as unknown as TItem, getTransactionPreviewData(transactionItem)); return; } From cb926bc87cf0cb0462ca19a3c693fd88b86bdc3f Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 24 Feb 2026 17:33:22 +0430 Subject: [PATCH 4/6] fixed prettier --- src/components/Search/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 13496496f1427..ae81b404f6fc2 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -475,9 +475,7 @@ function Search({ if (!validGroupBy) { return []; } - return (baseFilteredData as TransactionGroupListItemType[]) - .map((item) => hashToString(item.transactionsQueryJSON?.hash)) - .filter((hashValue): hashValue is string => !!hashValue); + return (baseFilteredData as TransactionGroupListItemType[]).map((item) => hashToString(item.transactionsQueryJSON?.hash)).filter((hashValue): hashValue is string => !!hashValue); }, [validGroupBy, baseFilteredData]); const groupByTransactionSnapshots = useMultipleSnapshots(groupByTransactionHashes); From b806adbbb7d660ddf9a4fd558b85897d62002bde Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Thu, 5 Mar 2026 08:43:04 +0430 Subject: [PATCH 5/6] addressed comment. --- .../Search/TransactionGroupListExpanded.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx index 3ad20b2660cec..47561f6d0f556 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx @@ -101,8 +101,8 @@ function TransactionGroupListExpanded({ return { hasParentReport: !!parentReport, - hasTransaction: false, - hasParentReportAction: !!parentReportAction || !!transactionItem.reportAction, + hasTransaction: !!transactionItem, + hasParentReportAction: !!parentReportAction, hasTransactionThreadReport: !!transactionThreadReport, }; }; From 109272c306bb1b1c46a96e41fa3fdb7422e92c59 Mon Sep 17 00:00:00 2001 From: Maruf Sharifi Date: Tue, 17 Mar 2026 08:34:55 +0430 Subject: [PATCH 6/6] Fix transaction preview Onyx existence check --- .../Search/TransactionGroupListExpanded.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx index 4dbd9d8f96eb5..7cb5be7d361d9 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListExpanded.tsx @@ -17,6 +17,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; import {getReportIDForTransaction} from '@libs/MoneyRequestReportUtils'; import Navigation from '@libs/Navigation/Navigation'; import {getReportAction} from '@libs/ReportActionsUtils'; @@ -61,6 +62,7 @@ function TransactionGroupListExpanded({ const [isMobileSelectionModeEnabled] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE); const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); const [visibleColumns] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {selector: columnsSelector}); + const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); const transactionsSnapshotMetadata = transactionsSnapshot?.search; @@ -99,10 +101,11 @@ function TransactionGroupListExpanded({ const parentReportAction = getReportAction(transactionItem?.reportID, transactionItem?.reportAction?.reportActionID); const parentReport = getReportOrDraftReport(transactionItem?.reportID); const transactionThreadReport = getReportOrDraftReport(transactionItem?.reportAction?.childReportID); + const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionItem?.transactionID)}`]; return { hasParentReport: !!parentReport, - hasTransaction: !!transactionItem, + hasTransaction: !!transaction, hasParentReportAction: !!parentReportAction, hasTransactionThreadReport: !!transactionThreadReport, };