Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 8 additions & 5 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,15 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
return;
}

// If USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step
if (policyCurrency === CONST.CURRENCY.USD && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) {
setUSDBankAccountStep(CONST.BANK_ACCOUNT.STEP.VALIDATION);

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.

This change caused #78356. Calling setUSDBankAccountStep(CONST.BANK_ACCOUNT.STEP.VALIDATION) here updated the UI to show the Validation step, but it didn't call goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.VALIDATION) to also update achData.currentStep. This mismatch meant the goBack handler still operated on the stale achData.currentStep value (e.g. BANK_ACCOUNT), so pressing back did nothing visible — the UI stayed on Validation while the internal step silently changed. Fixed in #82453.

return;
}

setShouldShowConnectedVerifiedBankAccount(isNonUSDWorkspace ? achData?.state === CONST.BANK_ACCOUNT.STATE.OPEN : achData?.currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE);
setShouldShowContinueSetupButton(shouldShowContinueSetupButtonValue);
}, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state]);
}, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state, policyCurrency]);

useEffect(
() => {
Expand Down Expand Up @@ -354,9 +360,6 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
case CONST.BANK_ACCOUNT.STEP.VALIDATION:
if ([CONST.BANK_ACCOUNT.STATE.VERIFYING, CONST.BANK_ACCOUNT.STATE.SETUP].some((value) => value === achData?.state)) {
goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT);
} else if (!isOffline && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) {
setShouldShowContinueSetupButton(true);
setUSDBankAccountStep(null);
} else {
Navigation.goBack();
}
Expand All @@ -365,7 +368,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
default:
Navigation.dismissModal();
}
}, [achData, currentStep, isOffline, onfidoToken]);
}, [achData, currentStep, onfidoToken]);

const isLoading =
(isLoadingApp || (reimbursementAccount?.isLoading && !reimbursementAccount?.isCreateCorpayBankAccount)) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ConnectBankAccount({onBackButtonPress, setShouldShowConnectedVerifiedBa
const {translate} = useLocalize();

const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: true});
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${reimbursementAccount?.achData?.policyID}}`, {canBeMissing: true});
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${reimbursementAccount?.achData?.policyID}`, {canBeMissing: true});
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});

const handleNavigateToConciergeChat = () => navigateToConciergeChat(true);
Expand Down
Loading