You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-06-06] [$500] [Workflows] Bank account and Authorized payer buttons displayed instead of Connect bank account #39947
@isabelastisser FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
So even when we do not complete the add bank account flow, we still set the value of reimburser:
And hence when we toggle the option, it takes data from Onyx as we have stored the value of reimburser temporarily in it and !!policy?.achAccount is set to true then and hence we see the approver and bank account field.
Note : If we refresh the page then hasVBA again becomes flase, as we have not stored the value of reimburser on the BE.
What changes do you think we should make in order to solve the problem?
We should only set hasVBA to true only when all the fields of ACHAccount are defined.
What alternative solutions did you explore? (Optional)
but here when we disable Make or track payments we set optimisticData with {reimburser: reimburserEmail} then after API response, report come with "achAccount": null
or just set the reimburser not whole achAccount to null {reimburser: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ? null : reimburserEmail}
and check it in hasVBA condition hasVBA = !!policy?.achAccount && !isEmptyObject(policy?.achAccount)
changed the title [-]BA - Bank account and Authorized payer buttons displayed instead of Connect bank account[/-][+][$250] BA - Bank account and Authorized payer buttons displayed instead of Connect bank account[/+]on Apr 10, 2024
Please re-state the problem that we are trying to solve in this issue
"Bank account" and "Authorized payer" buttons are displayed instead of "Connect bank account" after clicking the "Connect bank account" button and re-toggling "Make or track payments".
What is the root cause of that problem?
Everytime we toggle "Make or track payments", we call Policy.setWorkspaceReimbursementhere we set achAccount: {reimburser: reimburserEmail}here optimistically (optimisticData).
This was introduced by PR #39017, specifically for the scenario where a bank account is already added, in order to be able to change the Authorized payer while offline (optimistically).
The problem with this is that in our case, we don't yet have a bank account added and because the achAccount: {reimburser: reimburserEmail} is set everytime we toggle "Make or track payments", the UI ends up looking like we have a bank account added because of this check, when we don't actually have a bank account added yet.
Note
When offline, the following buttons are always disabled:
"Connect bank account" (when bank is not added yet)
"Bank account" (when bank exists)
The "Authorized payer" button is always enabled because we want to be able to change the Authorized payer even if we're offline, according to PR #39017.
What changes do you think we should make in order to solve the problem?
In order to maintain the functionality added by PR #39017 and also fix our issue, accounting for both flows (no BA added and with BA added) we have to perform the following changes:
Introduce a new loading variable isLoadingWorkspaceReimbursement for the SetWorkspaceReimbursement call because whenever we toggle "Make or track payments", the call takes a while and by doing this we're now able to show a spinner instead of the UI jumping from the "Connect bank account" button to "Bank account" and "Authorized payer" buttons. Already approved by design here, here and here.
The two repeating checks here and here will be replaced with the following check:
which removes hasVBA variable and instead replaces it with !!bankAccountID which actually checks if a BA exists in order to show the proper UI and styling here.
The following two checks 1.here and 2.here will be replaced with:
[@ikevin127] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: ❌
No need to open a discussion or update the PR review checklist as this was an issue which could've been mitigated by thoroughly testing the feature both while online and offline, which is already a checkbox on the PR author / reviewer checklist.
[@ikevin127] Determine if we should create a regression test for this bug.
[@ikevin127] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Regression Test Proposal
Create a new workspace.
Go to Workspace > More features and enable Workflows.
Go to Workspace > Workflows and under Make or track payments tap on Connect bank account.
Go back.
Disable Make or track payments then enable it again.
Verify that only the Connect bank account button is visible.
changed the title [-][HOLD for payment 2024-06-06] [$250] [Workflows] Bank account and Authorized payer buttons displayed instead of Connect bank account[/-][+][HOLD for payment 2024-06-06] [$500] [Workflows] Bank account and Authorized payer buttons displayed instead of Connect bank account[/+]on May 31, 2024
Activity
melvin-bot commentedon Apr 9, 2024
Triggered auto assignment to @isabelastisser (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.lanitochka17 commentedon Apr 9, 2024
@isabelastisser FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
allgandalf commentedon Apr 9, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
We see bank account and authorized payer options even when we haven't added bank account
What is the root cause of that problem?
We show
bank account & authorized payerbased on the conditionhasVBA:App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Line 87 in 5b1dbea
If this is false then we show
connect bank account page.Now when we click on connect bank account for the first time, we set a field inside of ACHaccount
reimburserto the admin's email:App/src/types/onyx/Policy.ts
Lines 187 to 194 in 5b1dbea
So even when we do not complete the add bank account flow, we still set the value of

reimburser:And hence when we toggle the option, it takes data from Onyx as we have stored the value of
reimbursertemporarily in it and!!policy?.achAccountis set to true then and hence we see the approver and bank account field.Note : If we refresh the page then
hasVBAagain becomes flase, as we have not stored the value ofreimburseron theBE.What changes do you think we should make in order to solve the problem?
We should only set
hasVBAto true only when all the fields ofACHAccountare defined.What alternative solutions did you explore? (Optional)
N/A
ahmedGaber93 commentedon Apr 10, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
BA - Bank account and Authorized payer buttons displayed instead of Connect bank account
What is the root cause of that problem?
We display Bank account or Connect bank account based on this condition.
App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Line 87 in 5b1dbea
but here when we disable
Make or track paymentswe setoptimisticDatawith{reimburser: reimburserEmail}then after API response, report come with"achAccount": nullApp/src/libs/actions/Policy.ts
Line 732 in aed0bf0
What changes do you think we should make in order to solve the problem?
We can define
hasVBAbased onbankAccountIDexisting notachAccountobjectWhat alternative solutions did you explore? (Optional)
We can also return the correct
optimisticDatalike API response, by set"achAccount": nullwhen disablingMake or track paymentsor just set the reimburser not whole achAccount to null
{reimburser: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO ? null : reimburserEmail}and check it in
hasVBAconditionhasVBA = !!policy?.achAccount && !isEmptyObject(policy?.achAccount)[-]BA - Bank account and Authorized payer buttons displayed instead of Connect bank account[/-][+][$250] BA - Bank account and Authorized payer buttons displayed instead of Connect bank account[/+]melvin-bot commentedon Apr 10, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01ad1e7b394f8ced40
melvin-bot commentedon Apr 10, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ishpaul777 (
External)ikevin127 commentedon Apr 10, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue
"Bank account" and "Authorized payer" buttons are displayed instead of "Connect bank account" after clicking the "Connect bank account" button and re-toggling "Make or track payments".
What is the root cause of that problem?
Everytime we toggle "Make or track payments", we call
Policy.setWorkspaceReimbursementhere we setachAccount: {reimburser: reimburserEmail}here optimistically (optimisticData).This was introduced by PR #39017, specifically for the scenario where a bank account is already added, in order to be able to change the Authorized payer while offline (optimistically).
The problem with this is that in our case, we don't yet have a bank account added and because the
achAccount: {reimburser: reimburserEmail}is set everytime we toggle "Make or track payments", the UI ends up looking like we have a bank account added because of this check, when we don't actually have a bank account added yet.Note
When offline, the following buttons are always disabled:
The "Authorized payer" button is always enabled because we want to be able to change the Authorized payer even if we're offline, according to PR #39017.
What changes do you think we should make in order to solve the problem?
In order to maintain the functionality added by PR #39017 and also fix our issue, accounting for both flows (no BA added and with BA added) we have to perform the following changes:
Introduce a new loading variable
isLoadingWorkspaceReimbursementfor theSetWorkspaceReimbursementcall because whenever we toggle "Make or track payments", the call takes a while and by doing this we're now able to show a spinner instead of the UI jumping from the "Connect bank account" button to "Bank account" and "Authorized payer" buttons. Already approved by design here, here and here.The two repeating checks here and here will be replaced with the following check:
which removes
hasVBAvariable and instead replaces it with!!bankAccountIDwhich actually checks if a BA exists in order to show the proper UI and styling here.replacing
hasVBAdirectly with!!policy?.achAccountcheck and:removing the
hasVBAcheck as it breaks the flow when we first toggle "Make or track payments" and we have BA added, by not showing the BA.Videos (without BA / with BA)
MacOS: Chrome / Safari
withoutBA.mov
withBA.mov
isabelastisser commentedon Apr 10, 2024
@ishpaul777 please review the proposals above. Thanks!
57 remaining items
ikevin127 commentedon May 30, 2024
No need to open a discussion or update the PR review checklist as this was an issue which could've been mitigated by thoroughly testing the feature both while online and offline, which is already a checkbox on the PR author / reviewer checklist.
Regression Test Proposal
Do we agree 👍 or 👎.
ikevin127 commentedon May 30, 2024
Note: This issue's bounty should be increased to $500 as per this Slack post, since it was always
HIGHpriority.cc @isabelastisser @lakchote
[-][HOLD for payment 2024-06-06] [$250] [Workflows] Bank account and Authorized payer buttons displayed instead of Connect bank account[/-][+][HOLD for payment 2024-06-06] [$500] [Workflows] Bank account and Authorized payer buttons displayed instead of Connect bank account[/+]melvin-bot commentedon May 31, 2024
Upwork job price has been updated to $500
lakchote commentedon May 31, 2024
I do agree. @isabelastisser I've increased the Upwork job price.
isabelastisser commentedon Jun 6, 2024
https://github.com/Expensify/Expensify/issues/402811
isabelastisser commentedon Jun 6, 2024
The offers were sent in Upwork. All set!
ishpaul777 commentedon Jun 6, 2024
Offer accepted! Thanks!
ikevin127 commentedon Jun 6, 2024
Offer accepted, thank you!
ishpaul777 commentedon Jun 12, 2024
ishpaul777 commentedon Jun 12, 2024
nvm my last comment i got it confused with another issue