From 37f99c14ae1f35915ecb6f3c8863b45fba67963d Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Sun, 19 Apr 2026 14:21:18 +0530 Subject: [PATCH 1/2] Remove unused exports (batch 5) Made-with: Cursor --- src/libs/actions/BankAccounts.ts | 2 -- src/libs/actions/CompanyCards.ts | 2 -- src/libs/actions/Delegate.ts | 2 -- src/libs/actions/HybridApp/index.ts | 2 +- src/libs/actions/IOU/BulkEdit.ts | 2 +- src/libs/actions/IOU/PayMoneyRequest.ts | 2 +- src/libs/actions/IOU/ReportWorkflow.ts | 1 - src/libs/actions/IOU/TrackExpense.ts | 5 ----- src/libs/actions/IOU/index.ts | 7 ------- .../utils/DeferredOnyxUpdates.ts | 15 +------------ src/libs/actions/PersonalDetails.ts | 21 ------------------- src/libs/actions/Policy/Policy.ts | 2 -- src/libs/actions/Policy/Tag.ts | 5 ----- src/libs/actions/QuickActionNavigation.ts | 2 +- .../actions/ReimbursementAccount/errors.ts | 2 +- .../actions/ReimbursementAccount/index.ts | 7 +------ .../actions/ReimbursementAccount/store.ts | 1 - src/libs/filterArrayByMatch.ts | 1 - src/libs/memoize/index.ts | 2 -- src/libs/telemetry/sendMemoryContext.ts | 1 - 20 files changed, 7 insertions(+), 77 deletions(-) diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index d35848039ea3..819bf530426c 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -47,8 +47,6 @@ import {setBankAccountSubStep} from './ReimbursementAccount'; export { goToWithdrawalAccountSetupStep, - setBankAccountFormValidationErrors, - resetReimbursementAccount, resetUSDBankAccount, resetNonUSDBankAccount, hideBankAccountErrors, diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index 228e9d9152e2..0934df684516 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -1425,9 +1425,7 @@ export { clearAddNewCardFlow, setAssignCardStepAndData, clearAssignCardStepAndData, - openAssignFeedCardPage, openPolicyAddCardFeedPage, - setTransactionStartDate, setFeedStatementPeriodEndDay, importCSVCompanyCards, clearErrorField, diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index a31097d7e3a7..ccdedfb77aa4 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -719,11 +719,9 @@ export { disconnect, clearDelegatorErrors, addDelegate, - requestValidationCode, clearDelegateErrorsByField, restoreDelegateSession, isConnectedAsDelegate, - clearDelegateRolePendingAction, updateDelegateRole, removeDelegate, openSecuritySettingsPage, diff --git a/src/libs/actions/HybridApp/index.ts b/src/libs/actions/HybridApp/index.ts index e19812e02518..c9cd9473d163 100644 --- a/src/libs/actions/HybridApp/index.ts +++ b/src/libs/actions/HybridApp/index.ts @@ -144,4 +144,4 @@ function resetSignInFlow() { }); } -export {getHybridAppSettings, setReadyToShowAuthScreens, resetSignInFlow, setUseNewDotSignInPage, setClosingReactNativeApp, closeReactNativeApp}; +export {getHybridAppSettings, setReadyToShowAuthScreens, resetSignInFlow, setUseNewDotSignInPage, closeReactNativeApp}; diff --git a/src/libs/actions/IOU/BulkEdit.ts b/src/libs/actions/IOU/BulkEdit.ts index c02cdbdf5136..c033a33e191d 100644 --- a/src/libs/actions/IOU/BulkEdit.ts +++ b/src/libs/actions/IOU/BulkEdit.ts @@ -580,5 +580,5 @@ function updateBulkEditDraftTransaction(transactionChanges: NullishDeep { - return deprecatedCurrentUserPersonalDetails; -} - function getRecentAttendees(): OnyxEntry { return recentAttendees; } @@ -3907,7 +3903,6 @@ export { calculateDiffAmount, getUpdatedMoneyRequestReportData, startDistanceRequest, - hasOutstandingChildRequest, getReportPreviewAction, mergePolicyRecentlyUsedCurrencies, mergePolicyRecentlyUsedCategories, @@ -3919,14 +3914,12 @@ export { getAllReportNameValuePairs, getAllTransactionDrafts, getCurrentUserEmail, - getCurrentUserPersonalDetails, getUserAccountID, getRecentAttendees, getReceiptError, // TODO: Replace getPolicyTagsData (https://github.com/Expensify/App/issues/72721) and getPolicyRecentlyUsedTagsData (https://github.com/Expensify/App/issues/71491) with useOnyx hook // eslint-disable-next-line @typescript-eslint/no-deprecated getPolicyTagsData, - maybeUpdateReportNameForFormulaTitle, getSearchOnyxUpdate, getPolicyTags, // eslint-disable-next-line @typescript-eslint/no-deprecated diff --git a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts index 0b6d2526844d..6a9e99b914fc 100644 --- a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts @@ -7,8 +7,6 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxUpdatesFromServer, Response} from '@src/types/onyx'; import {isValidOnyxUpdateFromServer} from '@src/types/onyx/OnyxUpdatesFromServer'; -// eslint-disable-next-line import/no-cycle -import {validateAndApplyDeferredUpdates} from '.'; // eslint-disable-next-line @typescript-eslint/no-explicit-any let missingOnyxUpdatesQueryPromise: Promise | Array> | void> | undefined; @@ -59,17 +57,6 @@ function isEmpty() { return Object.keys(deferredUpdates).length === 0; } -/** - * Manually processes and applies the updates from the deferred updates queue. (used e.g. for push notifications) - */ -function process() { - if (missingOnyxUpdatesQueryPromise) { - missingOnyxUpdatesQueryPromise.finally(() => validateAndApplyDeferredUpdates); - } - - missingOnyxUpdatesQueryPromise = validateAndApplyDeferredUpdates(); -} - type EnqueueDeferredOnyxUpdatesOptions = { shouldPauseSequentialQueue?: boolean; }; @@ -129,4 +116,4 @@ function clear(options?: ClearDeferredOnyxUpdatesOptions) { } } -export {getMissingOnyxUpdatesQueryPromise, setMissingOnyxUpdatesQueryPromise, getUpdates, isEmpty, process, enqueue, clear}; +export {getMissingOnyxUpdatesQueryPromise, setMissingOnyxUpdatesQueryPromise, getUpdates, isEmpty, enqueue, clear}; diff --git a/src/libs/actions/PersonalDetails.ts b/src/libs/actions/PersonalDetails.ts index a23958859a58..b5b721145641 100644 --- a/src/libs/actions/PersonalDetails.ts +++ b/src/libs/actions/PersonalDetails.ts @@ -505,26 +505,6 @@ function deleteAvatar(currentUserPersonalDetails: Pick { - return Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {achData: {state}}); -} - function hideBankAccountErrors() { Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {error: '', errors: null}); } @@ -76,7 +72,6 @@ export { cancelResetBankAccount, clearReimbursementAccount, clearReimbursementAccountDraft, - setBankAccountState, setReimbursementAccountOptionPressed, updateReimbursementAccount, }; diff --git a/src/libs/actions/ReimbursementAccount/store.ts b/src/libs/actions/ReimbursementAccount/store.ts index a92778fc50a3..6a6f9132bdca 100644 --- a/src/libs/actions/ReimbursementAccount/store.ts +++ b/src/libs/actions/ReimbursementAccount/store.ts @@ -13,5 +13,4 @@ function hasCreditBankAccount(bankAccountList: OnyxEntry(items: readonly T[], searchValue: string } export default filterArrayByMatch; -export {MATCH_RANK}; diff --git a/src/libs/memoize/index.ts b/src/libs/memoize/index.ts index b0dcaad2c752..3f6837db016a 100644 --- a/src/libs/memoize/index.ts +++ b/src/libs/memoize/index.ts @@ -112,5 +112,3 @@ function memoize Date: Sun, 19 Apr 2026 22:06:29 +0530 Subject: [PATCH 2/2] Fix lint --- src/libs/ReportUtils.ts | 2 +- src/libs/actions/CompanyCards.ts | 33 ----------------- src/libs/actions/Delegate.ts | 35 ------------------- src/libs/actions/HybridApp/index.ts | 8 ----- src/libs/actions/IOU/index.ts | 1 - src/libs/actions/QuickActionNavigation.ts | 1 + .../actions/ReimbursementAccount/errors.ts | 24 ------------- .../{store.ts => hasCreditBankAccount.ts} | 2 +- .../actions/ReimbursementAccount/index.ts | 13 ++++++- tests/unit/ReimbursementAccountTest.ts | 2 +- 10 files changed, 16 insertions(+), 105 deletions(-) delete mode 100644 src/libs/actions/ReimbursementAccount/errors.ts rename src/libs/actions/ReimbursementAccount/{store.ts => hasCreditBankAccount.ts} (93%) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4f44b20ab5af..72cb93c6ab2d 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -91,7 +91,7 @@ import {createDraftTransaction, setMoneyRequestParticipants, setMoneyRequestPart import type {IOURequestType} from './actions/IOU'; import {unholdRequest} from './actions/IOU/Hold'; import {createDraftWorkspace} from './actions/Policy/Policy'; -import {hasCreditBankAccount} from './actions/ReimbursementAccount/store'; +import hasCreditBankAccount from './actions/ReimbursementAccount/hasCreditBankAccount'; import {openUnreportedExpense} from './actions/Report'; import type {GuidedSetupData, TaskForParameters} from './actions/Report'; import {isAnonymousUser as isAnonymousUserSession} from './actions/Session'; diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index 0934df684516..60af6bfee331 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -154,10 +154,6 @@ function setAssignCardStepAndData({cardToAssign, isEditing, currentStep, isRefre Onyx.merge(ONYXKEYS.ASSIGN_CARD, {cardToAssign, isEditing, currentStep, isRefreshing}); } -function setTransactionStartDate(startDate: string) { - Onyx.merge(ONYXKEYS.ASSIGN_CARD, {startDate}); -} - function clearAssignCardStepAndData() { Onyx.set(ONYXKEYS.ASSIGN_CARD, {}); } @@ -1025,35 +1021,6 @@ function openPolicyCompanyCardsFeed(domainAccountID: number, policyID: string, f API.read(READ_COMMANDS.OPEN_POLICY_COMPANY_CARDS_FEED, parameters, {optimisticData, successData, failureData}); } -function openAssignFeedCardPage(policyID: string, feed: CompanyCardFeedWithNumber, domainOrWorkspaceAccountID: number) { - const parameters: OpenPolicyCompanyCardsFeedParams = { - policyID, - feed, - }; - - const optimisticData: Array> = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`, - value: { - isLoading: true, - }, - }, - ]; - - const finallyData: Array> = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`, - value: { - isLoading: false, - }, - }, - ]; - - API.read(READ_COMMANDS.OPEN_ASSIGN_FEED_CARD_PAGE, parameters, {optimisticData, finallyData}); -} - function openPolicyAddCardFeedPage(policyID: string | undefined) { if (!policyID) { return; diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index ccdedfb77aa4..4cbacabd6034 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -110,9 +110,6 @@ type IsConnectedAsDelegateParams = WithDelegatedAccess; // Connect as delegate type ConnectParams = WithEmail & WithDelegatedAccess & WithOldDotFlag & WithCredentials & WithSession & WithActivePolicyID; -// Clear pending action for role update -type ClearDelegateRolePendingActionParams = WithEmail & WithDelegatedAccess; - /** * Connects the user as a delegate to another account. * Returns a Promise that resolves to true on success, false on failure, or undefined if not applicable. @@ -332,10 +329,6 @@ function clearDelegatorErrors({delegatedAccess}: ClearDelegatorErrorsParams) { Onyx.merge(ONYXKEYS.ACCOUNT, {delegatedAccess: {delegators: delegatedAccess.delegators.map((delegator) => ({...delegator, errorFields: undefined}))}}); } -function requestValidationCode() { - API.write(WRITE_COMMANDS.RESEND_VALIDATE_CODE, null); -} - function addDelegate({email, role, validateCode, delegatedAccess}: AddDelegateParams) { if (!delegatedAccess?.delegates) { return; @@ -669,34 +662,6 @@ function updateDelegateRole({email, role, validateCode, delegatedAccess}: Update API.write(WRITE_COMMANDS.UPDATE_DELEGATE_ROLE, parameters, {optimisticData, successData, failureData}); } -function clearDelegateRolePendingAction({email, delegatedAccess}: ClearDelegateRolePendingActionParams) { - if (!delegatedAccess?.delegates) { - return; - } - - const optimisticData: Array> = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - delegatedAccess: { - delegates: delegatedAccess.delegates.map((delegate) => - delegate.email === email - ? { - ...delegate, - pendingAction: null, - pendingFields: undefined, - } - : delegate, - ), - }, - }, - }, - ]; - - Onyx.update(optimisticData); -} - function restoreDelegateSession(authenticateResponse: Response) { Onyx.clear(KEYS_TO_PRESERVE_DELEGATE_ACCESS).then(() => { updateSessionAuthTokens(authenticateResponse?.authToken, authenticateResponse?.encryptedAuthToken); diff --git a/src/libs/actions/HybridApp/index.ts b/src/libs/actions/HybridApp/index.ts index c9cd9473d163..8b9e2dfd815d 100644 --- a/src/libs/actions/HybridApp/index.ts +++ b/src/libs/actions/HybridApp/index.ts @@ -121,14 +121,6 @@ function setUseNewDotSignInPage(useNewDotSignInPage: boolean) { return Onyx.merge(ONYXKEYS.HYBRID_APP, {useNewDotSignInPage}); } -function setClosingReactNativeApp(closingReactNativeApp: boolean) { - // This value is only relevant for HybridApp, so we can skip it in other environments. - if (!CONFIG.IS_HYBRID_APP) { - return; - } - Onyx.merge(ONYXKEYS.HYBRID_APP, {closingReactNativeApp}); -} - /* * Starts HybridApp sign-in flow from the beginning. */ diff --git a/src/libs/actions/IOU/index.ts b/src/libs/actions/IOU/index.ts index 84e5ec731506..a38656f88aef 100644 --- a/src/libs/actions/IOU/index.ts +++ b/src/libs/actions/IOU/index.ts @@ -53,7 +53,6 @@ import { getParsedComment, getReportNotificationPreference, getReportOrDraftReport, - hasOutstandingChildRequest, hasViolations as hasViolationsReportUtils, isDeprecatedGroupDM, isExpenseReport, diff --git a/src/libs/actions/QuickActionNavigation.ts b/src/libs/actions/QuickActionNavigation.ts index 734fe27f34b6..72fd8139075b 100644 --- a/src/libs/actions/QuickActionNavigation.ts +++ b/src/libs/actions/QuickActionNavigation.ts @@ -79,4 +79,5 @@ function navigateToQuickAction(params: NavigateToQuickActionParams) { default: } } +// eslint-disable-next-line import/prefer-default-export export {navigateToQuickAction}; diff --git a/src/libs/actions/ReimbursementAccount/errors.ts b/src/libs/actions/ReimbursementAccount/errors.ts deleted file mode 100644 index ecf902a4cf97..000000000000 --- a/src/libs/actions/ReimbursementAccount/errors.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Onyx from 'react-native-onyx'; -import ONYXKEYS from '@src/ONYXKEYS'; -import type {ErrorFields} from '@src/types/onyx/OnyxCommon'; - -/** - * Set the current fields with errors. - */ -function setBankAccountFormValidationErrors(errorFields: ErrorFields) { - Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {errorFields: null}); - Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {errorFields}); -} - -/** - * Clear validation messages from reimbursement account - */ -function resetReimbursementAccount() { - setBankAccountFormValidationErrors({}); - Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, { - errors: null, - pendingAction: null, - }); -} - -export {resetReimbursementAccount}; diff --git a/src/libs/actions/ReimbursementAccount/store.ts b/src/libs/actions/ReimbursementAccount/hasCreditBankAccount.ts similarity index 93% rename from src/libs/actions/ReimbursementAccount/store.ts rename to src/libs/actions/ReimbursementAccount/hasCreditBankAccount.ts index 6a6f9132bdca..dd8e9b86ee81 100644 --- a/src/libs/actions/ReimbursementAccount/store.ts +++ b/src/libs/actions/ReimbursementAccount/hasCreditBankAccount.ts @@ -13,4 +13,4 @@ function hasCreditBankAccount(bankAccountList: OnyxEntry {