diff --git a/src/components/MoneyRequestReportView/MoneyRequestReportNavigation.tsx b/src/components/MoneyRequestReportView/MoneyRequestReportNavigation.tsx index 416975a083ac..8e86b92ad90c 100644 --- a/src/components/MoneyRequestReportView/MoneyRequestReportNavigation.tsx +++ b/src/components/MoneyRequestReportView/MoneyRequestReportNavigation.tsx @@ -39,7 +39,7 @@ function MoneyRequestReportNavigation({reportID, shouldDisplayNarrowVersion}: Mo const {type, status, sortBy, sortOrder, groupBy} = lastSearchQuery?.queryJSON ?? {}; let results: Array = []; if (!!type && !!currentSearchResults?.data && !!currentSearchResults?.search) { - const searchData = getSections({ + const [searchData] = getSections({ type, data: currentSearchResults.data, currentAccountID: currentUserDetails.accountID, diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 1caf807c7876..a1185174edbd 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -402,19 +402,19 @@ function Search({ const shouldShowLoadingMoreItems = !shouldShowLoadingState && searchResults?.search?.isLoading && searchResults?.search?.offset > 0; const prevIsSearchResultEmpty = usePrevious(isSearchResultsEmpty); - const [data, dataLength] = useMemo(() => { + const [filteredData, filteredDataLength, allDataLength] = useMemo(() => { if (searchResults === undefined || !isDataLoaded) { - return [[], 0]; + return [[], 0, 0]; } // Group-by option cannot be used for chats or tasks const isChat = type === CONST.SEARCH.DATA_TYPES.CHAT; const isTask = type === CONST.SEARCH.DATA_TYPES.TASK; if (validGroupBy && (isChat || isTask)) { - return [[], 0]; + return [[], 0, 0]; } - const data1 = getSections({ + const [filteredData1, allLength] = getSections({ type, data: searchResults.data, currentAccountID: accountID, @@ -427,7 +427,7 @@ function Search({ queryJSON, isActionLoadingSet, }); - return [data1, data1.length]; + return [filteredData1, filteredData1.length, allLength]; }, [searchKey, exportReportActions, validGroupBy, isDataLoaded, searchResults, type, archivedReportsIdSet, formatPhoneNumber, accountID, queryJSON, email, isActionLoadingSet]); useEffect(() => { @@ -444,7 +444,7 @@ function Search({ return; } - handleSearch({queryJSON, searchKey, offset, shouldCalculateTotals, prevReportsLength: dataLength}); + handleSearch({queryJSON, searchKey, offset, shouldCalculateTotals, prevReportsLength: filteredDataLength}); // We don't need to run the effect on change of isFocused. // eslint-disable-next-line react-compiler/react-compiler @@ -464,7 +464,7 @@ function Search({ } const newTransactionList: SelectedTransactions = {}; if (validGroupBy || isExpenseReportType) { - for (const transactionGroup of data) { + for (const transactionGroup of filteredData) { if (!Object.hasOwn(transactionGroup, 'transactions') || !('transactions' in transactionGroup)) { continue; } @@ -519,7 +519,7 @@ function Search({ } } } else { - for (const transactionItem of data) { + for (const transactionItem of filteredData) { if (!Object.hasOwn(transactionItem, 'transactionID') || !('transactionID' in transactionItem)) { continue; } @@ -567,11 +567,11 @@ function Search({ return; } - setSelectedTransactions(newTransactionList, data); + setSelectedTransactions(newTransactionList, filteredData); isRefreshingSelection.current = true; // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [data, setSelectedTransactions, areAllMatchingItemsSelected, isFocused, outstandingReportsByPolicyID, isExpenseReportType]); + }, [filteredData, setSelectedTransactions, areAllMatchingItemsSelected, isFocused, outstandingReportsByPolicyID, isExpenseReportType]); useEffect(() => { if (!isSearchResultsEmpty || prevIsSearchResultEmpty) { @@ -601,11 +601,11 @@ function Search({ return; } - if (!data.length || isRefreshingSelection.current) { + if (!filteredData.length || isRefreshingSelection.current) { return; } const areItemsGrouped = !!validGroupBy || type === CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT; - const flattenedItems = areItemsGrouped ? (data as TransactionGroupListItemType[]).flatMap((item) => item.transactions) : data; + const flattenedItems = areItemsGrouped ? (filteredData as TransactionGroupListItemType[]).flatMap((item) => item.transactions) : filteredData; const areAllItemsSelected = flattenedItems.length === Object.keys(selectedTransactions).length; // If the user has selected all the expenses in their view but there are more expenses matched by the search @@ -614,7 +614,7 @@ function Search({ if (!areAllItemsSelected) { selectAllMatchingItems(false); } - }, [isFocused, data, searchResults?.search?.hasMoreResults, selectedTransactions, selectAllMatchingItems, shouldShowSelectAllMatchingItems, validGroupBy, type]); + }, [isFocused, filteredData, searchResults?.search?.hasMoreResults, selectedTransactions, selectAllMatchingItems, shouldShowSelectAllMatchingItems, validGroupBy, type]); const toggleTransaction = useCallback( (item: SearchListItem, itemTransactions?: TransactionListItemType[]) => { @@ -631,7 +631,7 @@ function Search({ if (isTransactionPendingDelete(item)) { return; } - setSelectedTransactions(prepareTransactionsList(item, selectedTransactions, outstandingReportsByPolicyID), data); + setSelectedTransactions(prepareTransactionsList(item, selectedTransactions, outstandingReportsByPolicyID), filteredData); return; } @@ -643,7 +643,7 @@ function Search({ delete reducedSelectedTransactions[transaction.keyForList]; } - setSelectedTransactions(reducedSelectedTransactions, data); + setSelectedTransactions(reducedSelectedTransactions, filteredData); return; } @@ -656,10 +656,10 @@ function Search({ .map((transactionItem) => mapTransactionItemToSelectedEntry(transactionItem, outstandingReportsByPolicyID)), ), }, - data, + filteredData, ); }, - [data, selectedTransactions, outstandingReportsByPolicyID, setSelectedTransactions], + [filteredData, selectedTransactions, outstandingReportsByPolicyID, setSelectedTransactions], ); const onSelectRow = useCallback( @@ -801,7 +801,7 @@ function Search({ const sortedSelectedData = useMemo( () => - getSortedSections(type, status, data, localeCompare, sortBy, sortOrder, validGroupBy).map((item) => { + getSortedSections(type, status, filteredData, localeCompare, sortBy, sortOrder, validGroupBy).map((item) => { const baseKey = isChat ? `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${(item as ReportActionListItemType).reportActionID}` : `${ONYXKEYS.COLLECTION.TRANSACTION}${(item as TransactionListItemType).transactionID}`; @@ -822,7 +822,7 @@ function Search({ return mapToItemWithAdditionalInfo(item, selectedTransactions, canSelectMultiple, shouldAnimateInHighlight, hash); }), - [type, status, data, sortBy, sortOrder, validGroupBy, isChat, newSearchResultKeys, selectedTransactions, canSelectMultiple, localeCompare, hash], + [type, status, filteredData, sortBy, sortOrder, validGroupBy, isChat, newSearchResultKeys, selectedTransactions, canSelectMultiple, localeCompare, hash], ); useEffect(() => { @@ -840,12 +840,12 @@ function Search({ const fetchMoreResults = useCallback(() => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if (!isFocused || !searchResults?.search?.hasMoreResults || shouldShowLoadingState || shouldShowLoadingMoreItems || offset > data.length - CONST.SEARCH.RESULTS_PAGE_SIZE) { + if (!isFocused || !searchResults?.search?.hasMoreResults || shouldShowLoadingState || shouldShowLoadingMoreItems || offset > allDataLength - CONST.SEARCH.RESULTS_PAGE_SIZE) { return; } setOffset((prev) => prev + CONST.SEARCH.RESULTS_PAGE_SIZE); - }, [isFocused, searchResults?.search?.hasMoreResults, shouldShowLoadingMoreItems, shouldShowLoadingState, offset, data.length]); + }, [isFocused, searchResults?.search?.hasMoreResults, shouldShowLoadingMoreItems, shouldShowLoadingState, offset, allDataLength]); const toggleAllTransactions = useCallback(() => { const areItemsGrouped = !!validGroupBy || isExpenseReportType; @@ -859,13 +859,13 @@ function Search({ if (areItemsGrouped) { setSelectedTransactions( Object.fromEntries( - (data as TransactionGroupListItemType[]).flatMap((item) => + (filteredData as TransactionGroupListItemType[]).flatMap((item) => item.transactions .filter((t) => !isTransactionPendingDelete(t)) .map((transactionItem) => mapTransactionItemToSelectedEntry(transactionItem, outstandingReportsByPolicyID)), ), ), - data, + filteredData, ); return; @@ -873,13 +873,13 @@ function Search({ setSelectedTransactions( Object.fromEntries( - (data as TransactionListItemType[]) + (filteredData as TransactionListItemType[]) .filter((t) => !isTransactionPendingDelete(t)) .map((transactionItem) => mapTransactionItemToSelectedEntry(transactionItem, outstandingReportsByPolicyID)), ), - data, + filteredData, ); - }, [clearSelectedTransactions, data, validGroupBy, selectedTransactions, setSelectedTransactions, outstandingReportsByPolicyID, isExpenseReportType]); + }, [clearSelectedTransactions, filteredData, validGroupBy, selectedTransactions, setSelectedTransactions, outstandingReportsByPolicyID, isExpenseReportType]); const onLayout = useCallback(() => { endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB); @@ -930,7 +930,7 @@ function Search({ ); } - const visibleDataLength = data.filter((item) => item.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline).length; + const visibleDataLength = filteredData.filter((item) => item.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline).length; if (shouldShowEmptyState(isDataLoaded, visibleDataLength, searchResults?.search?.type)) { return ( diff --git a/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx b/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx index 318f8764bf19..54afb3815608 100644 --- a/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx +++ b/src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx @@ -104,14 +104,14 @@ function TransactionGroupListItem({ if (!transactionsSnapshot?.data) { return []; } - const sectionData = getSections({ + const [sectionData] = getSections({ type: CONST.SEARCH.DATA_TYPES.EXPENSE, data: transactionsSnapshot?.data, currentAccountID: accountID, currentUserEmail: currentUserDetails.email ?? '', formatPhoneNumber, isActionLoadingSet, - }) as TransactionListItemType[]; + }) as [TransactionListItemType[], number]; return sectionData.map((transactionItem) => ({ ...transactionItem, isSelected: selectedTransactionIDsSet.has(transactionItem.transactionID), diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 790f19203643..d4d93bcc9c1c 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -1042,7 +1042,7 @@ function getTransactionsSections( currentUserEmail: string, formatPhoneNumber: LocaleContextProps['formatPhoneNumber'], isActionLoadingSet: ReadonlySet | undefined, -): TransactionListItemType[] { +): [TransactionListItemType[], number] { const shouldShowMerchant = getShouldShowMerchant(data); const doesDataContainAPastYearTransaction = shouldShowYear(data); const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = getWideAmountIndicators(data); @@ -1129,7 +1129,7 @@ function getTransactionsSections( transactionsSections.push(transactionSection); } } - return transactionsSections; + return [transactionsSections, transactionsSections.length]; } /** @@ -1348,61 +1348,60 @@ function getTaskSections( data: OnyxTypes.SearchResults['data'], formatPhoneNumber: LocaleContextProps['formatPhoneNumber'], archivedReportsIDList?: ArchivedReportsIDSet, -): TaskListItemType[] { - return ( - Object.keys(data) - .filter(isReportEntry) - // Ensure that the reports that were passed are tasks, and not some other - // type of report that was sent as the parent - .filter((key) => isTaskListItemType(data[key] as SearchListItem)) - .map((key) => { - const taskItem = data[key] as SearchTask; - const personalDetails = data.personalDetailsList; - - const assignee = personalDetails?.[taskItem.managerID] ?? emptyPersonalDetails; - const createdBy = personalDetails?.[taskItem.accountID] ?? emptyPersonalDetails; - const formattedAssignee = formatPhoneNumber(getDisplayNameOrDefault(assignee)); - const formattedCreatedBy = formatPhoneNumber(getDisplayNameOrDefault(createdBy)); - - const report = getReportOrDraftReport(taskItem.reportID) ?? taskItem; - const parentReport = getReportOrDraftReport(taskItem.parentReportID); - - const doesDataContainAPastYearTransaction = shouldShowYear(data); - const reportName = StringUtils.lineBreaksToSpaces(Parser.htmlToText(taskItem.reportName)); - const description = StringUtils.lineBreaksToSpaces(Parser.htmlToText(taskItem.description)); - - const result: TaskListItemType = { - ...taskItem, - reportName, - description, - assignee, - formattedAssignee, - createdBy, - formattedCreatedBy, - keyForList: taskItem.reportID, - shouldShowYear: doesDataContainAPastYearTransaction, - }; +): [TaskListItemType[], number] { + const tasks = Object.keys(data) + .filter(isReportEntry) + // Ensure that the reports that were passed are tasks, and not some other + // type of report that was sent as the parent + .filter((key) => isTaskListItemType(data[key] as SearchListItem)) + .map((key) => { + const taskItem = data[key] as SearchTask; + const personalDetails = data.personalDetailsList; + + const assignee = personalDetails?.[taskItem.managerID] ?? emptyPersonalDetails; + const createdBy = personalDetails?.[taskItem.accountID] ?? emptyPersonalDetails; + const formattedAssignee = formatPhoneNumber(getDisplayNameOrDefault(assignee)); + const formattedCreatedBy = formatPhoneNumber(getDisplayNameOrDefault(createdBy)); + + const report = getReportOrDraftReport(taskItem.reportID) ?? taskItem; + const parentReport = getReportOrDraftReport(taskItem.parentReportID); + + const doesDataContainAPastYearTransaction = shouldShowYear(data); + const reportName = StringUtils.lineBreaksToSpaces(Parser.htmlToText(taskItem.reportName)); + const description = StringUtils.lineBreaksToSpaces(Parser.htmlToText(taskItem.description)); + + const result: TaskListItemType = { + ...taskItem, + reportName, + description, + assignee, + formattedAssignee, + createdBy, + formattedCreatedBy, + keyForList: taskItem.reportID, + shouldShowYear: doesDataContainAPastYearTransaction, + }; - if (parentReport && personalDetails) { - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 - // eslint-disable-next-line @typescript-eslint/no-deprecated - const policy = getPolicy(parentReport.policyID); - const isParentReportArchived = archivedReportsIDList?.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${parentReport?.reportID}`); - const parentReportName = getReportName(parentReport, policy, undefined, undefined, undefined, undefined, undefined, isParentReportArchived); - const icons = getIcons(parentReport, personalDetails, null, '', -1, policy, undefined, isParentReportArchived); - const parentReportIcon = icons?.at(0); - - result.parentReportName = parentReportName; - result.parentReportIcon = parentReportIcon; - } + if (parentReport && personalDetails) { + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line @typescript-eslint/no-deprecated + const policy = getPolicy(parentReport.policyID); + const isParentReportArchived = archivedReportsIDList?.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${parentReport?.reportID}`); + const parentReportName = getReportName(parentReport, policy, undefined, undefined, undefined, undefined, undefined, isParentReportArchived); + const icons = getIcons(parentReport, personalDetails, null, '', -1, policy, undefined, isParentReportArchived); + const parentReportIcon = icons?.at(0); + + result.parentReportName = parentReportName; + result.parentReportIcon = parentReportIcon; + } - if (report) { - result.report = report; - } + if (report) { + result.report = report; + } - return result; - }) - ); + return result; + }); + return [tasks, tasks.length]; } /** Creates transaction thread report and navigates to it from the search page */ @@ -1428,7 +1427,7 @@ function createAndOpenSearchTransactionThread(item: TransactionListItemType, has * * Do not use directly, use only via `getSections()` facade. */ -function getReportActionsSections(data: OnyxTypes.SearchResults['data']): ReportActionListItemType[] { +function getReportActionsSections(data: OnyxTypes.SearchResults['data']): [ReportActionListItemType[], number] { const reportActionItems: ReportActionListItemType[] = []; const transactions = Object.keys(data) @@ -1443,10 +1442,13 @@ function getReportActionsSections(data: OnyxTypes.SearchResults['data']): Report .filter(isPolicyEntry) .map((key) => data[key]); + let n = 0; + for (const key in data) { if (isReportActionEntry(key)) { - const reportActions = data[key]; - for (const reportAction of Object.values(reportActions)) { + const reportActions = Object.values(data[key]); + n += reportActions.length; + for (const reportAction of reportActions) { const from = reportAction.accountID ? (data.personalDetailsList?.[reportAction.accountID] ?? emptyPersonalDetails) : emptyPersonalDetails; const report = data[`${ONYXKEYS.COLLECTION.REPORT}${reportAction.reportID}`] ?? {}; const policy = data[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`] ?? {}; @@ -1478,7 +1480,7 @@ function getReportActionsSections(data: OnyxTypes.SearchResults['data']): Report } } } - return reportActionItems; + return [reportActionItems, n]; } /** @@ -1495,7 +1497,7 @@ function getReportSections( formatPhoneNumber: LocaleContextProps['formatPhoneNumber'], isActionLoadingSet: ReadonlySet | undefined, reportActions: Record = {}, -): TransactionGroupListItemType[] { +): [TransactionGroupListItemType[], number] { const shouldShowMerchant = getShouldShowMerchant(data); const doesDataContainAPastYearTransaction = shouldShowYear(data); @@ -1637,7 +1639,8 @@ function getReportSections( } } - return Object.values(reportIDToTransactions); + const reportIDToTransactionsValues = Object.values(reportIDToTransactions); + return [reportIDToTransactionsValues, reportIDToTransactionsValues.length]; } /** @@ -1646,7 +1649,7 @@ function getReportSections( * * Do not use directly, use only via `getSections()` facade. */ -function getMemberSections(data: OnyxTypes.SearchResults['data'], queryJSON: SearchQueryJSON | undefined): TransactionMemberGroupListItemType[] { +function getMemberSections(data: OnyxTypes.SearchResults['data'], queryJSON: SearchQueryJSON | undefined): [TransactionMemberGroupListItemType[], number] { const memberSections: Record = {}; for (const key in data) { @@ -1672,7 +1675,8 @@ function getMemberSections(data: OnyxTypes.SearchResults['data'], queryJSON: Sea } } - return Object.values(memberSections); + const memberSectionsValues = Object.values(memberSections); + return [memberSectionsValues, memberSectionsValues.length]; } /** @@ -1681,7 +1685,7 @@ function getMemberSections(data: OnyxTypes.SearchResults['data'], queryJSON: Sea * * Do not use directly, use only via `getSections()` facade. */ -function getCardSections(data: OnyxTypes.SearchResults['data'], queryJSON: SearchQueryJSON | undefined): TransactionCardGroupListItemType[] { +function getCardSections(data: OnyxTypes.SearchResults['data'], queryJSON: SearchQueryJSON | undefined): [TransactionCardGroupListItemType[], number] { const cardSections: Record = {}; for (const key in data) { @@ -1708,7 +1712,8 @@ function getCardSections(data: OnyxTypes.SearchResults['data'], queryJSON: Searc } } - return Object.values(cardSections); + const cardSectionsValues = Object.values(cardSections); + return [cardSectionsValues, cardSectionsValues.length]; } /** @@ -1717,7 +1722,7 @@ function getCardSections(data: OnyxTypes.SearchResults['data'], queryJSON: Searc * * Do not use directly, use only via `getSections()` facade. */ -function getWithdrawalIDSections(data: OnyxTypes.SearchResults['data'], queryJSON: SearchQueryJSON | undefined): TransactionWithdrawalIDGroupListItemType[] { +function getWithdrawalIDSections(data: OnyxTypes.SearchResults['data'], queryJSON: SearchQueryJSON | undefined): [TransactionWithdrawalIDGroupListItemType[], number] { const withdrawalIDSections: Record = {}; for (const key in data) { @@ -1741,7 +1746,8 @@ function getWithdrawalIDSections(data: OnyxTypes.SearchResults['data'], queryJSO } } - return Object.values(withdrawalIDSections); + const withdrawalIDSectionsValues = Object.values(withdrawalIDSections); + return [withdrawalIDSectionsValues, withdrawalIDSectionsValues.length]; } /** diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index 7d34e9206ca9..763f19835c44 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -1741,15 +1741,15 @@ describe('SearchUIUtils', () => { describe('Test getSections', () => { it('should return getReportActionsSections result when type is CHAT', () => { - expect( - SearchUIUtils.getSections({ - type: CONST.SEARCH.DATA_TYPES.CHAT, - data: searchResults.data, - currentAccountID: 2074551, - currentUserEmail: '', - formatPhoneNumber, - }), - ).toStrictEqual(reportActionListItems); + const [filteredReportActions, allReportActionsLength] = SearchUIUtils.getSections({ + type: CONST.SEARCH.DATA_TYPES.CHAT, + data: searchResults.data, + currentAccountID: 2074551, + currentUserEmail: '', + formatPhoneNumber, + }); + expect(filteredReportActions).toStrictEqual(reportActionListItems); + expect(allReportActionsLength).toBe(6); }); it('should return getTransactionsSections result when groupBy is undefined', () => { @@ -1760,7 +1760,7 @@ describe('SearchUIUtils', () => { currentAccountID: 20745, currentUserEmail: '', formatPhoneNumber, - }), + })[0], ).toEqual(transactionsListItems); }); @@ -1784,7 +1784,7 @@ describe('SearchUIUtils', () => { currentAccountID: 2074551, currentUserEmail: '', formatPhoneNumber, - }) as TransactionListItemType[]; + })[0] as TransactionListItemType[]; const distanceTransaction = result.find((item) => item.transactionID === distanceTransactionID); @@ -1815,7 +1815,7 @@ describe('SearchUIUtils', () => { currentAccountID: 2074551, currentUserEmail: '', formatPhoneNumber, - }) as TransactionGroupListItemType[]; + })[0] as TransactionGroupListItemType[]; const reportGroup = result.find((group) => group.transactions?.some((transaction) => transaction.transactionID === distanceTransactionID)); @@ -1836,7 +1836,7 @@ describe('SearchUIUtils', () => { currentAccountID: 2074551, currentUserEmail: '', formatPhoneNumber, - }), + })[0], ).toStrictEqual(transactionReportGroupListItems); }); @@ -1875,14 +1875,14 @@ describe('SearchUIUtils', () => { currentAccountID: 2074551, currentUserEmail: '', formatPhoneNumber, - }); + })[0]; const resultReportFirst = SearchUIUtils.getSections({ type: CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT, data: testDataReportFirst, currentAccountID: 2074551, currentUserEmail: '', formatPhoneNumber, - }); + })[0]; expect(resultTransactionFirst).toBeDefined(); expect(Array.isArray(resultTransactionFirst)).toBe(true); @@ -1903,7 +1903,7 @@ describe('SearchUIUtils', () => { currentUserEmail: '', formatPhoneNumber, groupBy: CONST.SEARCH.GROUP_BY.FROM, - }), + })[0], ).toStrictEqual(transactionMemberGroupListItems); }); @@ -1916,7 +1916,7 @@ describe('SearchUIUtils', () => { currentUserEmail: '', formatPhoneNumber, groupBy: CONST.SEARCH.GROUP_BY.CARD, - }), + })[0], ).toStrictEqual(transactionCardGroupListItems); }); @@ -1929,7 +1929,7 @@ describe('SearchUIUtils', () => { currentUserEmail: '', formatPhoneNumber, groupBy: CONST.SEARCH.GROUP_BY.WITHDRAWAL_ID, - }), + })[0], ).toStrictEqual(transactionWithdrawalIDGroupListItems); }); });