Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a2747ba
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 2, 2026
d5b15bd
fix: 79312 Better existing BA detection
MrMuzyk Feb 2, 2026
5383489
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 12, 2026
8b9e3e8
fix: extra dep
MrMuzyk Feb 12, 2026
7867ebd
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 12, 2026
b53280e
fix: workspace switching
MrMuzyk Feb 12, 2026
05f1716
fix: pre-set loading
MrMuzyk Feb 12, 2026
1217955
fix: use existing action to set loading state for reimbursement account
MrMuzyk Feb 12, 2026
f4eebc7
fix: optimistically update bankAccountList
MrMuzyk Feb 13, 2026
a330463
fix: cr fixes
MrMuzyk Feb 13, 2026
250cece
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 17, 2026
fb95d38
fix: close rhp after trying to go back right after connecting BA
MrMuzyk Feb 17, 2026
f51b6e8
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 18, 2026
967978e
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 18, 2026
08261c5
fix: flash upon connecting
MrMuzyk Feb 18, 2026
0a95681
chore: small change and comment
MrMuzyk Feb 18, 2026
5f96410
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 23, 2026
3093035
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 24, 2026
2504568
fix: cr fixes
MrMuzyk Feb 24, 2026
2b03dc4
fix: return early when account ID is the same
MrMuzyk Feb 25, 2026
4ef746e
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Feb 25, 2026
c7ad2b3
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Mar 3, 2026
d2cd3b6
Merge branch 'main' of https://github.com/Expensify/App into fix/7931…
MrMuzyk Mar 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/components/KYCWall/BaseKYCWall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {openPersonalBankAccountSetupView} from '@libs/actions/BankAccounts';
import {completePaymentOnboarding, savePreferredPaymentMethod} from '@libs/actions/IOU';
import {navigateToBankAccountRoute} from '@libs/actions/ReimbursementAccount';
import {moveIOUReportToPolicy, moveIOUReportToPolicyAndInviteSubmitter} from '@libs/actions/Report';
import {isBankAccountPartiallySetup} from '@libs/BankAccountUtils';
import {doesPolicyHavePartiallySetupBankAccount} from '@libs/BankAccountUtils';
import getClickedTargetLocation from '@libs/getClickedTargetLocation';
import Log from '@libs/Log';
import setNavigationActionToMicrotaskQueue from '@libs/Navigation/helpers/setNavigationActionToMicrotaskQueue';
Expand Down Expand Up @@ -63,7 +63,6 @@ function KYCWall({
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT);

const {formatPhoneNumber} = useLocalize();
const currentUserDetails = useCurrentUserPersonalDetails();
Expand Down Expand Up @@ -178,11 +177,7 @@ function KYCWall({
return;
}

// If user has a setup in progress for we redirect to the flow where setup can be finished
// Setup is in progress in 2 cases:
// - account already present on policy is partially setup
// - account is being connected 'on the spot' while trying to pay for an expense (it won't be linked to policy yet but will appear as reimbursementAccount)
if (policy !== undefined && (isBankAccountPartiallySetup(policy?.achAccount?.state) || isBankAccountPartiallySetup(reimbursementAccount?.achData?.state))) {
if (policy?.id !== undefined && doesPolicyHavePartiallySetupBankAccount(bankAccountList, policy.id)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ PERF-2 (docs)

The check if (policy?.id !== undefined happens after accessing doesPolicyHavePartiallySetupBankAccount(bankAccountList, policy.id), which could potentially cause issues if policy.id is undefined.

Suggested fix:

if (!policy?.id) {
    return;
}

if (doesPolicyHavePartiallySetupBankAccount(bankAccountList, policy.id)) {
    navigateToBankAccountRoute(policy.id);
    return;
}

This ensures early return before calling functions with potentially undefined values.


Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not need to be explicitly formatted as standalone early return clause, short-circuit happens in correct order and PERF-2 can be followed this way too.

navigateToBankAccountRoute({policyID: policy.id});
return;
}
Expand All @@ -202,16 +197,15 @@ function KYCWall({
onSelectPaymentMethod,
iouReport,
addDebitCardRoute,
reimbursementAccount?.achData?.state,
addBankAccountRoute,
chatReport,
policies,
reportPreviewAction,
currentUserEmail,
employeeEmail,
reportTransactions,
introSelected,
formatPhoneNumber,
reportTransactions,
lastPaymentMethod,
betas,
],
Expand Down
13 changes: 12 additions & 1 deletion src/libs/BankAccountUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,19 @@ function isBankAccountPartiallySetup(state: string | undefined) {
return state === CONST.BANK_ACCOUNT.STATE.SETUP || state === CONST.BANK_ACCOUNT.STATE.VERIFYING || state === CONST.BANK_ACCOUNT.STATE.PENDING;
}

function doesPolicyHavePartiallySetupBankAccount(bankAccountList: OnyxEntry<OnyxTypes.BankAccountList>, policyID: string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ PERF-2 (docs)

The function performs expensive work (Object.values, .find()) before checking if the result exists.

Suggested fix:

function doesPolicyHavePartiallySetupBankAccount(bankAccountList: OnyxEntry<OnyxTypes.BankAccountList>, policyID: string) {
    if (!bankAccountList) {
        return false;
    }
    
    const bankAccounts = Object.values(bankAccountList);
    const matchingBankAccount = bankAccounts.find((bankAccount) => bankAccount.accountData?.policyIDs?.includes(policyID));

    return isBankAccountPartiallySetup(matchingBankAccount?.accountData?.state);
}

This avoids calling Object.values on a potentially null/undefined value.


Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

if (!bankAccountList) {
return false;
}

const bankAccounts = Object.values(bankAccountList);
const matchingBankAccount = bankAccounts.find((bankAccount) => bankAccount.accountData?.policyIDs?.includes(policyID));

return isBankAccountPartiallySetup(matchingBankAccount?.accountData?.state);
}

function hasPartiallySetupBankAccount(bankAccountList: OnyxEntry<OnyxTypes.BankAccountList>): boolean {
return Object.values(bankAccountList ?? {}).some((bankAccount) => isBankAccountPartiallySetup(bankAccount?.accountData?.state));
}

export {getDefaultCompanyWebsite, getLastFourDigits, hasPartiallySetupBankAccount, isBankAccountPartiallySetup};
export {getDefaultCompanyWebsite, getLastFourDigits, hasPartiallySetupBankAccount, isBankAccountPartiallySetup, doesPolicyHavePartiallySetupBankAccount};
8 changes: 6 additions & 2 deletions src/libs/ReimbursementAccountUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ const hasInProgressNonUSDVBBA = (achData?: ACHDataReimbursementAccount): boolean
};

/** Returns true if VBBA flow is in progress */
const hasInProgressVBBA = (achData?: ACHDataReimbursementAccount, isNonUSDWorkspace?: boolean) => {
if (isNonUSDWorkspace ?? (!!achData?.currency && achData.currency !== CONST.CURRENCY.USD)) {
const hasInProgressVBBA = (achData?: ACHDataReimbursementAccount, isNonUSDWorkspace?: boolean, policyID?: string) => {
if (achData?.policyID !== policyID) {
return false;
}

if (isNonUSDWorkspace) {
return hasInProgressNonUSDVBBA(achData);
}

Expand Down
63 changes: 61 additions & 2 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
state?: string;
lastPaymentMethod?: LastPaymentMethodType | string;
shouldUpdateLastPaymentMethod?: boolean;
bankAccountList?: BankAccountList;
};

type SetWorkspaceApprovalModeAdditionalData = {
Expand All @@ -235,7 +236,7 @@
};

const deprecatedAllPolicies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 239 in src/libs/actions/Policy/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (val, key) => {
if (!key) {
Expand All @@ -251,7 +252,7 @@
});

let deprecatedAllReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 255 in src/libs/actions/Policy/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -261,7 +262,7 @@

let deprecatedSessionEmail = '';
let deprecatedSessionAccountID = 0;
Onyx.connect({

Check warning on line 265 in src/libs/actions/Policy/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (val) => {
deprecatedSessionEmail = val?.email ?? '';
Expand All @@ -270,7 +271,7 @@
});

let deprecatedAllPersonalDetails: OnyxEntry<PersonalDetailsList>;
Onyx.connect({

Check warning on line 274 in src/libs/actions/Policy/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (val) => (deprecatedAllPersonalDetails = val),
});
Expand Down Expand Up @@ -1102,13 +1103,23 @@
state,
lastPaymentMethod,
shouldUpdateLastPaymentMethod,
bankAccountList = {},
}: SetWorkspaceReimbursementActionParams) {
// 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(policyID);
const lastUsedPaymentMethod = typeof lastPaymentMethod === 'string' ? lastPaymentMethod : lastPaymentMethod?.expense?.name;

const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.POLICY>> = [
const oldBankAccountID = Object.keys(bankAccountList ?? {}).find((accountID) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to early return if oldBankAccountID === bankAccountID. The check in ConnectExistingBusinessBankAccountPage.tsx is not sufficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular scenario you're concerned about?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already handled in ConnectExistingBusinessBankAccountPage but I've added the requested early return here as well.
If somebody would like to use this action in a different place it might've become a problem

const account = bankAccountList?.[accountID];
return account?.accountData?.policyIDs?.includes(policyID);
});

if (oldBankAccountID !== undefined && String(bankAccountID) === oldBankAccountID) {
return;
}

const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.POLICY | typeof ONYXKEYS.BANK_ACCOUNT_LIST>> = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
Expand All @@ -1123,6 +1134,31 @@
},
];

if (bankAccountID !== undefined && bankAccountList !== undefined) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ PERF-2 (docs)

The code performs expensive work (Object.keys(bankAccountList ?? {}).find()) before checking if bankAccountID and bankAccountList are defined.

Suggested fix:

if (bankAccountID === undefined || \!bankAccountList) {
    return;
}

const optimisticBankAccountList: BankAccountList = {};
const oldBankAccountID = Object.keys(bankAccountList).find((accountID) => {
    const account = bankAccountList[accountID];
    return account?.accountData?.policyIDs?.includes(policyID);
});
// ... rest of the logic

This ensures early return before performing expensive iterations.


Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not only this case is almost identical to the one that written but it's wrong. If returned early here we would alter the logic of the method and wouldnt perform API call.

const optimisticBankAccountList: BankAccountList = {};
if (oldBankAccountID) {
optimisticBankAccountList[oldBankAccountID] = {
...optimisticBankAccountList[oldBankAccountID],
accountData: {
policyIDs: bankAccountList?.[oldBankAccountID]?.accountData?.policyIDs?.filter((id) => id !== policyID) ?? [],
},
};
}
const currentPolicyIDs = bankAccountList?.[bankAccountID]?.accountData?.policyIDs ?? [];
optimisticBankAccountList[bankAccountID] = {
...optimisticBankAccountList[bankAccountID],
accountData: {
policyIDs: [...new Set([...currentPolicyIDs, policyID])],
},
};

optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.BANK_ACCOUNT_LIST,
value: optimisticBankAccountList,
});
}

const successData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.POLICY | typeof ONYXKEYS.NVP_LAST_PAYMENT_METHOD>> = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -1155,7 +1191,7 @@
});
}

const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.POLICY>> = [
const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.POLICY | typeof ONYXKEYS.BANK_ACCOUNT_LIST>> = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
Expand All @@ -1176,6 +1212,29 @@
},
];

if (bankAccountID !== undefined && bankAccountList !== undefined) {
const failureBankAccountList: BankAccountList = {};
if (oldBankAccountID) {
failureBankAccountList[oldBankAccountID] = {
...failureBankAccountList[oldBankAccountID],
accountData: {
policyIDs: bankAccountList?.[oldBankAccountID]?.accountData?.policyIDs ?? [],
},
};
}
failureBankAccountList[bankAccountID] = {
...failureBankAccountList[bankAccountID],
accountData: {
policyIDs: bankAccountList?.[bankAccountID]?.accountData?.policyIDs ?? [],
},
};
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.BANK_ACCOUNT_LIST,
value: failureBankAccountList,
});
}

const params: SetWorkspaceReimbursementParams = {policyID, reimbursementChoice, bankAccountID};

API.write(WRITE_COMMANDS.SET_WORKSPACE_REIMBURSEMENT, params, {optimisticData, failureData, successData});
Expand Down
10 changes: 5 additions & 5 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
}

const shouldShowContinueSetupButtonValue = useMemo(() => {
return hasInProgressVBBA(achData, isNonUSDSetup);
}, [achData, isNonUSDSetup]);
return hasInProgressVBBA(achData, isNonUSDWorkspace, policyIDParam);
}, [achData, isNonUSDWorkspace, policyIDParam]);

const isDefaultReimbursementAccountData = deepEqual(reimbursementAccount, CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA);
const hasLoadedData = reimbursementAccount?.achData && !isDefaultReimbursementAccountData && reimbursementAccount?.isLoading === false;
const hasLoadedData = reimbursementAccount?.achData && !isDefaultReimbursementAccountData && !reimbursementAccount?.isLoading;
/**
When this page is first opened, `reimbursementAccount` prop might not yet be fully loaded from Onyx.
Calculating `shouldShowContinueSetupButton` immediately on initial render doesn't make sense as
Expand Down Expand Up @@ -342,7 +342,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
navigation.setParams({stepToOpen});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[isOffline, reimbursementAccount?.draftStep, reimbursementAccount?.pendingAction, hasACHDataBeenLoaded, shouldShowContinueSetupButton, currentStep],
[isOffline, reimbursementAccount?.draftStep, reimbursementAccount?.pendingAction, reimbursementAccount?.isLoading, hasACHDataBeenLoaded, shouldShowContinueSetupButton, currentStep],
);

const continueUSDVBBASetup = useCallback(() => {
Expand Down Expand Up @@ -492,7 +492,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
// Show loading indicator when page is first time being opened and props.reimbursementAccount yet to be loaded from the server
// or when data is being loaded. Don't show the loading indicator if we're offline and restarted the bank account setup process
// On Android, when we open the app from the background, Onfido activity gets destroyed, so we need to reopen it.
if ((isLoading || isLoadingWorkspaceReimbursement) && shouldShowOfflineLoader && (shouldReopenOnfido || !requestorStepRef?.current)) {
if ((!hasACHDataBeenLoaded || isLoading || isLoadingWorkspaceReimbursement) && shouldShowOfflineLoader && (shouldReopenOnfido || !requestorStepRef?.current)) {
return <ReimbursementAccountLoadingIndicator onBackButtonPress={goBack} />;
}

Expand Down
34 changes: 21 additions & 13 deletions src/pages/workspace/ConnectExistingBusinessBankAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {PlatformStackScreenProps} from '@navigation/PlatformStackNavigation
import type {ConnectExistingBankAccountNavigatorParamList} from '@navigation/types';
import PaymentMethodList from '@pages/settings/Wallet/PaymentMethodList';
import type {PaymentMethodPressHandlerParams} from '@pages/settings/Wallet/WalletPage/types';
import {setReimbursementAccountLoading} from '@userActions/BankAccounts';
import {setWorkspaceReimbursement} from '@userActions/Policy/Policy';
import {navigateToBankAccountRoute} from '@userActions/ReimbursementAccount';
import CONST from '@src/CONST';
Expand All @@ -27,6 +28,7 @@ function ConnectExistingBusinessBankAccountPage({route}: ConnectExistingBusiness
const policyID = route.params?.policyID;
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
const [lastPaymentMethod] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD);
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const policyName = policy?.name ?? '';
const policyCurrency = policy?.outputCurrency ?? '';
const {shouldUseNarrowLayout} = useResponsiveLayout();
Expand All @@ -44,23 +46,29 @@ function ConnectExistingBusinessBankAccountPage({route}: ConnectExistingBusiness
}

const newReimburserEmail = policy?.achAccount?.reimburser ?? policy?.owner ?? '';
setWorkspaceReimbursement({
policyID,
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES,
bankAccountID: methodID ?? CONST.DEFAULT_NUMBER_ID,
reimburserEmail: newReimburserEmail,
accountNumber: accountData?.accountNumber,
addressName: accountData?.addressName,
bankName: accountData?.additionalData?.bankName,
state: accountData?.state,
lastPaymentMethod: lastPaymentMethod?.[policyID],
shouldUpdateLastPaymentMethod: accountData?.state === CONST.BANK_ACCOUNT.STATE.OPEN,
});

if (bankAccountList && methodID && !bankAccountList[methodID]?.accountData?.policyIDs?.includes(policyID)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-6 (docs)

The code checks if bankAccountList && methodID && !bankAccountList[methodID]?.accountData?.policyIDs?.includes(policyID) but there is no error handling for the case when these conditions are false. This creates a silent failure path where the user action does not provide feedback.

Suggested fix:
Add logging or user feedback when the bank account is already connected to the policy:

if (bankAccountList && methodID && !bankAccountList[methodID]?.accountData?.policyIDs?.includes(policyID)) {
    setWorkspaceReimbursement({
        // ... existing code
    });
    setReimbursementAccountLoading(true);
} else {
    // Log or notify when bank account is already linked
    Log.info([ConnectExistingBusinessBankAccountPage] Bank account already linked to policy, {policyID, methodID});
}

Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

@MrMuzyk MrMuzyk Feb 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's already linked then we do not link it again and do nothing

setWorkspaceReimbursement({
policyID,
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES,
bankAccountID: methodID ?? CONST.DEFAULT_NUMBER_ID,
reimburserEmail: newReimburserEmail,
accountNumber: accountData?.accountNumber,
addressName: accountData?.addressName,
bankName: accountData?.additionalData?.bankName,
state: accountData?.state,
lastPaymentMethod: lastPaymentMethod?.[policyID],
shouldUpdateLastPaymentMethod: accountData?.state === CONST.BANK_ACCOUNT.STATE.OPEN,
bankAccountList,
});
setReimbursementAccountLoading(true);
}

Navigation.setNavigationActionToMicrotaskQueue(() => {
if (isBankAccountPartiallySetup(accountData?.state)) {
navigateToBankAccountRoute({policyID: route.params.policyID});
navigateToBankAccountRoute({policyID: route.params.policyID, navigationOptions: {forceReplace: true}});
} else {
setReimbursementAccountLoading(false);
Navigation.closeRHPFlow();
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps)
const achData = reimbursementAccount?.achData;

const shouldShowContinueModal = useMemo(() => {
return hasInProgressVBBA(achData, isNonUSDWorkspace);
}, [achData, isNonUSDWorkspace]);
return hasInProgressVBBA(achData, isNonUSDWorkspace, policyID);
}, [achData, isNonUSDWorkspace, policyID]);

const confirmCurrencyChangeAndHideModal = useCallback(() => {
if (!policy) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ function WorkspaceWorkflowsPage({policy, route}: WorkspaceWorkflowsPageProps) {
const achData = reimbursementAccount?.achData;

const shouldShowContinueModal = useMemo(() => {
return hasInProgressVBBA(achData, isNonUSDWorkspace);
}, [achData, isNonUSDWorkspace]);
return hasInProgressVBBA(achData, isNonUSDWorkspace, policy?.id);
}, [achData, isNonUSDWorkspace, policy?.id]);

const onPressAutoReportingFrequency = useCallback(() => Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS_AUTOREPORTING_FREQUENCY.getRoute(route.params.policyID)), [route.params.policyID]);

Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/AccountData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type AccountData = {

/** The debit card ID */
fundID?: number;

/** List of policies this account is linked to */
policyIDs?: string[];
};

export default AccountData;
Loading