Skip to content

Commit ab5acf4

Browse files
committed
Pass state instead
1 parent fee575e commit ab5acf4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libs/actions/BankAccounts.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,16 @@ function fetchUserWallet() {
335335
* Fetch the bank account currently being set up by the user for the free plan if it exists.
336336
*
337337
* @param {String} [stepToOpen]
338-
* @param {Boolean} [hasLocalOpenVBA]
338+
* @param {String} [localBankAccountState]
339339
*/
340-
function fetchFreePlanVerifiedBankAccount(stepToOpen, hasLocalOpenVBA = false) {
340+
function fetchFreePlanVerifiedBankAccount(stepToOpen, localBankAccountState) {
341341
// Remember which account BankAccountStep subStep the user had before so we can set it later
342342
const subStep = lodashGet(reimbursementAccountInSetup, 'subStep', '');
343343
const initialData = {loading: true, error: ''};
344-
if (hasLocalOpenVBA) {
345-
initialData.achData = {state: BankAccount.STATE.OPEN};
344+
345+
// Some UI needs to know the bank account state during the loading process, so we are keeping it in Onyx if passed
346+
if (localBankAccountState) {
347+
initialData.achData = {state: localBankAccountState};
346348
}
347349

348350
// We are using set here since we will rely on data from the server (not local data) to populate the VBA flow

src/pages/workspace/WorkspacePageWithSections.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ const defaultProps = {
4747
class WorkspacePageWithSections extends React.Component {
4848
componentDidMount() {
4949
const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', '');
50-
const hasVBA = achState === BankAccount.STATE.OPEN;
51-
fetchFreePlanVerifiedBankAccount('', hasVBA);
50+
fetchFreePlanVerifiedBankAccount('', achState);
5251
}
5352

5453
render() {

0 commit comments

Comments
 (0)