From 6ae4e494d00d7f9a7b00404eabf2a70e1a8b9e62 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 7 Nov 2025 14:33:30 -0700 Subject: [PATCH 01/15] rm unused return value --- src/libs/actions/IOU.ts | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index b38056d30596..8d8df57517f4 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -8653,8 +8653,6 @@ function deleteMoneyRequest( reportPreviewAction, } = prepareToCleanUpMoneyRequest(transactionID, reportAction, iouReport, chatReport, isChatIOUReportArchived, false, transactionIDsPendingDeletion, selectedTransactionIDs); - const urlToNavigateBack = getNavigationUrlOnMoneyRequestDelete(transactionID, reportAction, iouReport, chatReport, isChatIOUReportArchived, isSingleTransactionView); - // STEP 2: Build Onyx data // The logic mostly resembles the cleanUpMoneyRequest function const optimisticData: OnyxUpdate[] = [ @@ -8917,8 +8915,6 @@ function deleteMoneyRequest( // STEP 3: Make the API request API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, parameters, {optimisticData, successData, failureData}); clearPdfByOnyxKey(transactionID); - - return urlToNavigateBack; } function deleteTrackExpense({ @@ -8938,21 +8934,9 @@ function deleteTrackExpense({ return; } - const urlToNavigateBack = getNavigationUrlAfterTrackExpenseDelete( - chatReportID, - chatReport, - transactionID, - reportAction, - iouReport, - chatIOUReport, - isSingleTransactionView, - isChatIOUReportArchived, - ); - // STEP 1: Get all collections we're updating if (!isSelfDM(chatReport)) { deleteMoneyRequest(transactionID, reportAction, transactions, violations, iouReport, chatIOUReport, isChatIOUReportArchived, isSingleTransactionView); - return urlToNavigateBack; } const whisperAction = getTrackExpenseActionableWhisper(transactionID, chatReportID); @@ -8972,9 +8956,6 @@ function deleteTrackExpense({ // STEP 6: Make the API request API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, parameters, {optimisticData, successData, failureData}); clearPdfByOnyxKey(transactionID); - - // STEP 7: Navigate the user depending on which page they are on and which resources were deleted - return urlToNavigateBack; } /** From 526d01e73504b9c3a951cf8c971c84f513aabb47 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 7 Nov 2025 14:36:48 -0700 Subject: [PATCH 02/15] revert changes --- src/libs/actions/IOU.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 8d8df57517f4..b38056d30596 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -8653,6 +8653,8 @@ function deleteMoneyRequest( reportPreviewAction, } = prepareToCleanUpMoneyRequest(transactionID, reportAction, iouReport, chatReport, isChatIOUReportArchived, false, transactionIDsPendingDeletion, selectedTransactionIDs); + const urlToNavigateBack = getNavigationUrlOnMoneyRequestDelete(transactionID, reportAction, iouReport, chatReport, isChatIOUReportArchived, isSingleTransactionView); + // STEP 2: Build Onyx data // The logic mostly resembles the cleanUpMoneyRequest function const optimisticData: OnyxUpdate[] = [ @@ -8915,6 +8917,8 @@ function deleteMoneyRequest( // STEP 3: Make the API request API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, parameters, {optimisticData, successData, failureData}); clearPdfByOnyxKey(transactionID); + + return urlToNavigateBack; } function deleteTrackExpense({ @@ -8934,9 +8938,21 @@ function deleteTrackExpense({ return; } + const urlToNavigateBack = getNavigationUrlAfterTrackExpenseDelete( + chatReportID, + chatReport, + transactionID, + reportAction, + iouReport, + chatIOUReport, + isSingleTransactionView, + isChatIOUReportArchived, + ); + // STEP 1: Get all collections we're updating if (!isSelfDM(chatReport)) { deleteMoneyRequest(transactionID, reportAction, transactions, violations, iouReport, chatIOUReport, isChatIOUReportArchived, isSingleTransactionView); + return urlToNavigateBack; } const whisperAction = getTrackExpenseActionableWhisper(transactionID, chatReportID); @@ -8956,6 +8972,9 @@ function deleteTrackExpense({ // STEP 6: Make the API request API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST, parameters, {optimisticData, successData, failureData}); clearPdfByOnyxKey(transactionID); + + // STEP 7: Navigate the user depending on which page they are on and which resources were deleted + return urlToNavigateBack; } /** From b22a13bdb777391aef032e4ade53f83e11d6afb1 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 7 Nov 2025 14:40:39 -0700 Subject: [PATCH 03/15] loop over transactions --- src/libs/actions/Search.ts | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index d1513b01065c..0097880d6876 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -593,31 +593,23 @@ function unholdMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { } function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { - const {optimisticData: loadingOptimisticData, finallyData} = getOnyxLoadingData(hash); - const optimisticData: OnyxUpdate[] = [ - ...loadingOptimisticData, - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, - value: { - data: Object.fromEntries( - transactionIDList.map((transactionID) => [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}]), - ) as Partial, - }, - }, - ]; - const failureData: OnyxUpdate[] = [ - { + transactionIDList.forEach((transactionID) => { + const optimisticData: OnyxUpdate[] = [{ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, value: { - data: Object.fromEntries( - transactionIDList.map((transactionID) => [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {pendingAction: null}]), - ) as Partial, + data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}}, }, - }, - ]; - API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, failureData, finallyData}); + }]; + const failureData: OnyxUpdate[] = [{ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, + value: { + data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: null}}, + }, + }]; + API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, failureData, finallyData}); + }); } type Params = Record; From d6c8f577b775fcdcc29c52c13a9160ab7854735a Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 7 Nov 2025 14:42:58 -0700 Subject: [PATCH 04/15] add finally data --- src/libs/actions/Search.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 0097880d6876..5e3504042409 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -598,16 +598,23 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, value: { - data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}}, + data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {isActionLoading: true, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}}, }, }]; const failureData: OnyxUpdate[] = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, - value: { - data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: null}}, - }, + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, + value: { + data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: null}}, + }, }]; + const finallyData: OnyxUpdate[] = [{ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, + value: { + data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {isActionLoading: false}}, + }, + }] API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, failureData, finallyData}); }); } From 0a4a3651ed558c08d493400dab163e4fb78660e1 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 7 Nov 2025 14:47:15 -0700 Subject: [PATCH 05/15] update param --- src/libs/actions/Search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 5e3504042409..07690f0c728b 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -614,8 +614,8 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { value: { data: {[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {isActionLoading: false}}, }, - }] - API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, failureData, finallyData}); + }]; + API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList: [transactionID]}, {optimisticData, failureData, finallyData}); }); } From 889925d61f652055d9adf1a01d9ff8aaaaa9c2cb Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 14 Nov 2025 15:36:52 -0700 Subject: [PATCH 06/15] add optimistic data --- src/libs/actions/Search.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 3c3d1f677df3..2eb798fb9f34 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -680,6 +680,7 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[], c // @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const optimisticData: OnyxUpdate[] = [ + ...loadingOptimisticData, { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, From e8368f0c9b0f35d288d2fd8bedbbc833253e313a Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 17 Nov 2025 15:48:14 -0700 Subject: [PATCH 07/15] rm offline count update --- src/libs/actions/Search.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 2eb798fb9f34..6c43e5a248fb 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -669,13 +669,8 @@ function unholdMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[], currentSearchResults?: SearchResults) { const {optimisticData: loadingOptimisticData, finallyData} = getOnyxLoadingData(hash); - let runningCount = currentSearchResults?.search?.count ?? 0; - let runningTotal = currentSearchResults?.search?.total ?? 0; - transactionIDList.forEach((transactionID) => { const transaction = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]; - const newTotal = runningTotal - (transaction?.convertedAmount ?? 0); - const newCount = Math.max(0, runningCount - 1); // @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment @@ -688,10 +683,6 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[], c data: { [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}, } as Partial, - search: { - count: newCount, - total: newTotal, - }, }, }, ]; @@ -704,17 +695,10 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[], c data: { [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: null}, } as Partial, - search: { - count: runningCount, - total: runningTotal, - }, }, }, ]; - runningCount = newCount; - runningTotal = newTotal; - API.write(WRITE_COMMANDS.DELETE_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList: [transactionID]}, {optimisticData, failureData, finallyData}); }); } From 213450710adc6fbc33885e479acbe32f6644bc84 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 17 Nov 2025 15:50:38 -0700 Subject: [PATCH 08/15] rm unused var --- src/libs/actions/Search.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 6c43e5a248fb..11a4c6b5e505 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -670,8 +670,6 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[], c const {optimisticData: loadingOptimisticData, finallyData} = getOnyxLoadingData(hash); transactionIDList.forEach((transactionID) => { - const transaction = currentSearchResults?.data?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]; - // @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const optimisticData: OnyxUpdate[] = [ From a92818d1ebf39f3a0e71469eb9222dd3a349ef08 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 17 Nov 2025 15:53:02 -0700 Subject: [PATCH 09/15] rm move unused vars --- src/libs/actions/Search.ts | 2 +- src/pages/Search/SearchPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 11a4c6b5e505..9db561e41803 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -666,7 +666,7 @@ function unholdMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { API.write(WRITE_COMMANDS.UNHOLD_MONEY_REQUEST_ON_SEARCH, {hash, transactionIDList}, {optimisticData, finallyData}); } -function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[], currentSearchResults?: SearchResults) { +function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { const {optimisticData: loadingOptimisticData, finallyData} = getOnyxLoadingData(hash); transactionIDList.forEach((transactionID) => { diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 463dfe9bff36..be7d3938b418 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -638,7 +638,7 @@ function SearchPage({route}: SearchPageProps) { // We need to wait for modal to fully disappear before clearing them to avoid translation flicker between singular vs plural // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { - deleteMoneyRequestOnSearch(hash, selectedTransactionsKeys, currentSearchResults); + deleteMoneyRequestOnSearch(hash, selectedTransactionsKeys); clearSelectedTransactions(); }); }; From 92003054ffb7988230194816dc5da1c2136a7792 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 17 Nov 2025 15:53:53 -0700 Subject: [PATCH 10/15] rm unused import --- 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 9db561e41803..8e9fd624fd4d 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -45,7 +45,6 @@ import type {ExportTemplate, LastPaymentMethod, LastPaymentMethodType, Policy, R import type {PaymentInformation} from '@src/types/onyx/LastPaymentMethod'; import type {ConnectionName} from '@src/types/onyx/Policy'; import type {SearchReport, SearchTransaction} from '@src/types/onyx/SearchResults'; -import type SearchResults from '@src/types/onyx/SearchResults'; import type Nullable from '@src/types/utils/Nullable'; import SafeString from '@src/utils/SafeString'; import {setPersonalBankAccountContinueKYCOnSuccess} from './BankAccounts'; From b2fc3d15ccc3578d6d43b0cc6b44ee4e807679bb Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Mon, 17 Nov 2025 16:14:25 -0700 Subject: [PATCH 11/15] fix eslint --- src/pages/Search/SearchPage.tsx | 36 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index be7d3938b418..110d54790cbb 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -1,5 +1,7 @@ import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'; +import type {FC} from 'react'; import {InteractionManager, View} from 'react-native'; +import type {SvgProps} from 'react-native-svg'; import type {ValueOf} from 'type-fest'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import type {DropdownOption} from '@components/ButtonWithDropdownMenu/types'; @@ -8,7 +10,6 @@ import DecisionModal from '@components/DecisionModal'; import DragAndDropConsumer from '@components/DragAndDrop/Consumer'; import DragAndDropProvider from '@components/DragAndDrop/Provider'; import DropZoneUI from '@components/DropZone/DropZoneUI'; -import * as Expensicons from '@components/Icon/Expensicons'; import type {PaymentMethodType} from '@components/KYCWall/types'; import type {PopoverMenuItem} from '@components/PopoverMenu'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -23,6 +24,7 @@ import type {PaymentData, SearchParams} from '@components/Search/types'; import {usePlaybackContext} from '@components/VideoPlayerContexts/PlaybackContext'; import useBulkPayOptions from '@hooks/useBulkPayOptions'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useFilesValidation from '@hooks/useFilesValidation'; import useLocalize from '@hooks/useLocalize'; import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; @@ -104,6 +106,7 @@ function SearchPage({route}: SearchPageProps) { const [newParentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${newReport?.parentReportID}`, {canBeMissing: true}); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false}); const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`, {canBeMissing: true}); + const expensifyIcons = useMemoizedLazyExpensifyIcons(['Table', 'Export', 'ArrowRight', 'ThumbsUp', 'Send', 'Stopwatch', 'MoneyBag', 'Trashcan', 'DocumentMerge', 'Exclamation', 'SmartScan'] as const); const personalPolicy = usePersonalPolicy(); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); const [integrationsExportTemplates] = useOnyx(ONYXKEYS.NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES, {canBeMissing: true}); @@ -308,7 +311,7 @@ function SearchPage({route}: SearchPageProps) { const exportOptions: PopoverMenuItem[] = [ { text: translate('export.basicExport'), - icon: Expensicons.Table, + icon: expensifyIcons.Table, onSelected: () => { if (isOffline) { setIsOfflineModalVisible(true); @@ -355,7 +358,7 @@ function SearchPage({route}: SearchPageProps) { for (const template of exportTemplates) { exportOptions.push({ text: template.name, - icon: Expensicons.Table, + icon: expensifyIcons.Table, description: template.description, onSelected: () => { beginExportWithTemplate(template.templateName, template.type, template.policyID); @@ -369,8 +372,8 @@ function SearchPage({route}: SearchPageProps) { }; const exportButtonOption: DropdownOption & Pick = { - icon: Expensicons.Export, - rightIcon: Expensicons.ArrowRight, + icon: expensifyIcons.Export, + rightIcon: expensifyIcons.ArrowRight as unknown as FC, text: translate('common.export'), backButtonText: translate('common.export'), value: CONST.SEARCH.BULK_ACTION_TYPES.EXPORT, @@ -395,7 +398,7 @@ function SearchPage({route}: SearchPageProps) { if (shouldShowApproveOption) { options.push({ - icon: Expensicons.ThumbsUp, + icon: expensifyIcons.ThumbsUp, text: translate('search.bulkActions.approve'), value: CONST.SEARCH.BULK_ACTION_TYPES.APPROVE, shouldCloseModalOnSelect: true, @@ -441,7 +444,7 @@ function SearchPage({route}: SearchPageProps) { if (shouldShowSubmitOption) { options.push({ - icon: Expensicons.Send, + icon: expensifyIcons.Send, text: translate('common.submit'), value: CONST.SEARCH.BULK_ACTION_TYPES.SUBMIT, shouldCloseModalOnSelect: true, @@ -472,9 +475,9 @@ function SearchPage({route}: SearchPageProps) { if (shouldShowPayOption) { const payButtonOption = { - icon: Expensicons.MoneyBag, + icon: expensifyIcons.MoneyBag, text: translate('search.bulkActions.pay'), - rightIcon: isFirstTimePayment ? Expensicons.ArrowRight : undefined, + rightIcon: isFirstTimePayment ? expensifyIcons.ArrowRight : undefined, value: CONST.SEARCH.BULK_ACTION_TYPES.PAY, shouldCloseModalOnSelect: true, subMenuItems: isFirstTimePayment ? bulkPayButtonOptions : undefined, @@ -489,7 +492,7 @@ function SearchPage({route}: SearchPageProps) { if (shouldShowHoldOption) { options.push({ - icon: Expensicons.Stopwatch, + icon: expensifyIcons.Stopwatch, text: translate('search.bulkActions.hold'), value: CONST.SEARCH.BULK_ACTION_TYPES.HOLD, shouldCloseModalOnSelect: true, @@ -508,7 +511,7 @@ function SearchPage({route}: SearchPageProps) { if (shouldShowUnholdOption) { options.push({ - icon: Expensicons.Stopwatch, + icon: expensifyIcons.Stopwatch, text: translate('search.bulkActions.unhold'), value: CONST.SEARCH.BULK_ACTION_TYPES.UNHOLD, shouldCloseModalOnSelect: true, @@ -551,7 +554,7 @@ function SearchPage({route}: SearchPageProps) { if (canAllTransactionsBeMoved && !hasMultipleOwners) { options.push({ text: translate('iou.moveExpenses', {count: selectedTransactionsKeys.length}), - icon: Expensicons.DocumentMerge, + icon: expensifyIcons.DocumentMerge, value: CONST.SEARCH.BULK_ACTION_TYPES.CHANGE_REPORT, shouldCloseModalOnSelect: true, onSelected: () => Navigation.navigate(ROUTES.MOVE_TRANSACTIONS_SEARCH_RHP), @@ -562,7 +565,7 @@ function SearchPage({route}: SearchPageProps) { if (shouldShowDeleteOption) { options.push({ - icon: Expensicons.Trashcan, + icon: expensifyIcons.Trashcan, text: translate('search.bulkActions.delete'), value: CONST.SEARCH.BULK_ACTION_TYPES.DELETE, shouldCloseModalOnSelect: true, @@ -592,7 +595,7 @@ function SearchPage({route}: SearchPageProps) { }; options.push({ - icon: Expensicons.Exclamation, + icon: expensifyIcons.Exclamation, text: translate('search.bulkActions.noOptionsAvailable'), value: undefined, ...emptyOptionStyle, @@ -625,6 +628,7 @@ function SearchPage({route}: SearchPageProps) { selectedPolicyIDs, selectedReportIDs, selectedTransactionReportIDs, + expensifyIcons, ]); const handleDeleteExpenses = () => { @@ -821,7 +825,7 @@ function SearchPage({route}: SearchPageProps) { /> Date: Tue, 18 Nov 2025 09:15:46 -0700 Subject: [PATCH 12/15] fix prettier --- src/pages/Search/SearchPage.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 110d54790cbb..72276e4dae6d 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -24,8 +24,8 @@ import type {PaymentData, SearchParams} from '@components/Search/types'; import {usePlaybackContext} from '@components/VideoPlayerContexts/PlaybackContext'; import useBulkPayOptions from '@hooks/useBulkPayOptions'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; -import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useFilesValidation from '@hooks/useFilesValidation'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useNetwork from '@hooks/useNetwork'; @@ -106,7 +106,19 @@ function SearchPage({route}: SearchPageProps) { const [newParentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${newReport?.parentReportID}`, {canBeMissing: true}); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false}); const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`, {canBeMissing: true}); - const expensifyIcons = useMemoizedLazyExpensifyIcons(['Table', 'Export', 'ArrowRight', 'ThumbsUp', 'Send', 'Stopwatch', 'MoneyBag', 'Trashcan', 'DocumentMerge', 'Exclamation', 'SmartScan'] as const); + const expensifyIcons = useMemoizedLazyExpensifyIcons([ + 'Table', + 'Export', + 'ArrowRight', + 'ThumbsUp', + 'Send', + 'Stopwatch', + 'MoneyBag', + 'Trashcan', + 'DocumentMerge', + 'Exclamation', + 'SmartScan', + ] as const); const personalPolicy = usePersonalPolicy(); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); const [integrationsExportTemplates] = useOnyx(ONYXKEYS.NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES, {canBeMissing: true}); From c4d6ad88045b00362dad2f8dcf9679ae64c53f73 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 20 Nov 2025 10:52:19 -0700 Subject: [PATCH 13/15] fix some errors --- src/libs/actions/Search.ts | 4 ++-- src/pages/Search/SearchPage.tsx | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 2789e112bfe8..986f53d1a363 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -711,7 +711,7 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { value: { data: { [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE}, - } as Partial, + }, }, }, ]; @@ -723,7 +723,7 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { value: { data: { [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: null}, - } as Partial, + }, }, }, ]; diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 494c75c0162f..ad559fefa3aa 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -1,7 +1,5 @@ import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react'; -import type {FC} from 'react'; import {InteractionManager, View} from 'react-native'; -import type {SvgProps} from 'react-native-svg'; import type {ValueOf} from 'type-fest'; import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import type {DropdownOption} from '@components/ButtonWithDropdownMenu/types'; From c2ffa5f0211ac1bf834461958f6bedc7ddadec4f Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 20 Nov 2025 15:35:56 -0700 Subject: [PATCH 14/15] rm unused code --- src/libs/actions/Search.ts | 3 +-- src/pages/Search/SearchPage.tsx | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index e4c6a1e14d70..9f10edca970a 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -33,7 +33,7 @@ import { isIOUReport as isIOUReportUtil, } from '@libs/ReportUtils'; import type {SearchKey} from '@libs/SearchUIUtils'; -import {getSnapshotKeys, isTransactionGroupListItemType} from '@libs/SearchUIUtils'; +import {isTransactionGroupListItemType} from '@libs/SearchUIUtils'; import playSound, {SOUNDS} from '@libs/Sound'; import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; import CONST from '@src/CONST'; @@ -46,7 +46,6 @@ import type {PaymentInformation} from '@src/types/onyx/LastPaymentMethod'; import type {ConnectionName} from '@src/types/onyx/Policy'; // eslint-disable-next-line @typescript-eslint/no-deprecated import type {SearchReport} from '@src/types/onyx/SearchResults'; -import type SearchResults from '@src/types/onyx/SearchResults'; import type Nullable from '@src/types/utils/Nullable'; import SafeString from '@src/utils/SafeString'; import {setPersonalBankAccountContinueKYCOnSuccess} from './BankAccounts'; diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 8154e9d8a43d..e56d95f2277c 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -106,8 +106,6 @@ function SearchPage({route}: SearchPageProps) { const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`, {canBeMissing: true}); const personalPolicy = usePersonalPolicy(); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); - const [allSnapshots] = useOnyx(ONYXKEYS.COLLECTION.SNAPSHOT, {canBeMissing: true}); - const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: true}); const [integrationsExportTemplates] = useOnyx(ONYXKEYS.NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES, {canBeMissing: true}); const [csvExportLayouts] = useOnyx(ONYXKEYS.NVP_CSV_EXPORT_LAYOUTS, {canBeMissing: true}); const [isOfflineModalVisible, setIsOfflineModalVisible] = useState(false); From 93587d6f1ab8cdacd16777a4834e140b1e01ad9d Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 20 Nov 2025 15:37:32 -0700 Subject: [PATCH 15/15] add comment --- src/libs/actions/Search.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/actions/Search.ts b/src/libs/actions/Search.ts index 9f10edca970a..bc3aced9c062 100644 --- a/src/libs/actions/Search.ts +++ b/src/libs/actions/Search.ts @@ -723,6 +723,8 @@ function deleteMoneyRequestOnSearch(hash: number, transactionIDList: string[]) { key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, value: { data: { + // @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830 + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment [`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`]: {pendingAction: null}, }, },