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
11 changes: 9 additions & 2 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,21 @@ function fetchUserWallet() {
* Fetch the bank account currently being set up by the user for the free plan if it exists.
*
* @param {String} [stepToOpen]
* @param {String} [localBankAccountState]
*/
function fetchFreePlanVerifiedBankAccount(stepToOpen) {
function fetchFreePlanVerifiedBankAccount(stepToOpen, localBankAccountState) {
// Remember which account BankAccountStep subStep the user had before so we can set it later
const subStep = lodashGet(reimbursementAccountInSetup, 'subStep', '');
const initialData = {loading: true, error: ''};

// Some UI needs to know the bank account state during the loading process, so we are keeping it in Onyx if passed
if (localBankAccountState) {
initialData.achData = {state: localBankAccountState};
}

// We are using set here since we will rely on data from the server (not local data) to populate the VBA flow
// and determine which step to navigate to.
Onyx.set(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {loading: true, error: ''});
Onyx.set(ONYXKEYS.REIMBURSEMENT_ACCOUNT, initialData);
let bankAccountID;

API.Get({
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspacePageWithSections.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const defaultProps = {

class WorkspacePageWithSections extends React.Component {
componentDidMount() {
fetchFreePlanVerifiedBankAccount();
const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', '');
fetchFreePlanVerifiedBankAccount('', achState);
}

render() {
Expand Down