Skip to content

Commit

Permalink
Merge pull request #39633 from bernhardoj/fix/33047-connect-option-no…
Browse files Browse the repository at this point in the history
…t-show

Fix connect option page doesn't show after close and reopen the bank account page
  • Loading branch information
marcochavezf authored Apr 26, 2024
2 parents addcbfb + 3dffd64 commit 7727e0e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ function ReimbursementAccountPage({
/**
* Retrieve verified business bank account currently being set up.
* @param ignoreLocalCurrentStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx).
* @param ignoreLocalSubStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx).
*/
function fetchData(ignoreLocalCurrentStep?: boolean) {
function fetchData(ignoreLocalCurrentStep?: boolean, ignoreLocalSubStep?: boolean) {
// Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue
BankAccounts.setReimbursementAccountLoading(true);

Expand All @@ -233,11 +234,17 @@ function ReimbursementAccountPage({
const stepToOpen = getStepToOpenFromRouteParams(route);
const subStep = achData?.subStep ?? '';
const localCurrentStep = achData?.currentStep ?? '';
BankAccounts.openReimbursementAccountPage(stepToOpen, subStep, ignoreLocalCurrentStep ? '' : localCurrentStep, policyIDParam);
BankAccounts.openReimbursementAccountPage(stepToOpen, ignoreLocalSubStep ? '' : subStep, ignoreLocalCurrentStep ? '' : localCurrentStep, policyIDParam);
}

useEffect(() => {
fetchData();
// If the step to open is empty, we want to clear the sub step, so the connect option view is shown to the user
const isStepToOpenEmpty = getStepToOpenFromRouteParams(route) === '';
if (isStepToOpenEmpty) {
BankAccounts.setBankAccountSubStep(null);
BankAccounts.setPlaidEvent(null);
}
fetchData(false, isStepToOpenEmpty);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); // The empty dependency array ensures this runs only once after the component mounts.

Expand Down

0 comments on commit 7727e0e

Please sign in to comment.