-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return to the correct sub step in VBA flow after error in adding Bank Account manually #5186
Conversation
The subState in the VBA flow was being copied from Onyx into a local state in the BankAccountStep component and it was read from this local state. This caused that when we update the subState from BankAccounts.js in Onyx, the component BankAccountStep missed the update because it was reading it from the local state.
Withdrawal account data was being loaded from AuthScreens component, and then again from ReiumbursementAccountPage on mount. Moved the code handling the step from route to componentDidUpdate in ReimbursementAccountPage and is not fetching anymore.
…ubstep-after-error
Hey @marcaaron , can you have a look at this? I think this fixes the problem and avoid some unnecessary double fetching of data from the backend, but then maybe I'm missing something. |
Hey @aldo-expensify, I can take a look at this but I'm having some trouble following the explanation in the details section. Can you try using a bulleted list with links or code snippets (permalinks) to specific things in the code you are calling out? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a quick look at this PR. I haven't yet taken the time to understand what it is doing or why but just ran through to give some suggestions on style and convention. Thanks!
ok, I'll do that! |
It was true that the details were a bit cryptic, I had to debug it again to understand what was going on. Hopefully the new explanation is easier to understand. |
Ok I read the first half of what you've wrote and I think I agree that it would be best to only rely on the
We need to know the
I don't really know for sure to tell you the truth. If I had to guess we did it this way because it's not easy to set just one property of the As for the second half of this problem... to be honest, I think it should maybe be handled in another PR / issue. If you wait enough time for the requests to all finish then we wouldn't have the issue. So it seems unrelated to the first problem and more related to the fact that we are making an extra http request. |
👍
Ok, makes sense, I haven't looked into that code yet.
The double fetch was already there, but it didn't cause any visible problem because of the local state keeping a copy of the |
My preference will always be to fix one issue at a time mostly because if the one half of this has a regression then you don't have to roll back 100% of it. But also less complexity makes things move faster. |
Moving the details about the double fetch here to clean up the PR's description. Also, this is not causing problems anymore, so it there it is low priority to do something about it now. After the change I did to read the trimmed.movBasically, if you navigate to This is happening because:
Ways to solve the second problem:
I took the approach of avoiding to do a second fetch. |
Update:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me, but I'm not 100% sure about the change in BankAccounts.js
gonna do some testing and tag in @Jag96 to take a look at my comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passes the initial tests for me, but I ran into an issue when performing the following steps:
- Add manual account information (as specified in existing test steps)
- Verified error message appeared
- Navigated back to previous step
- Selected the Plaid menu item
- Signed into chase test bank
- Error still shows..
- Selected the savings account option and advanced to the company step.
- Pressed to go back to previous step
- Manual step shown (I'm not sure if that is expected or we should return to the Plaid screen?)
- Enter a valid routing and account number (
acct: 011401533
rtg: 1111222233331111
) - Advance to company step
- Go back to previous step
- Enter
11
for account number - We are able to advance to the company step now despite entering an invalid account number
Not sure if these are blockers or if they are happening on main
as well. Going to test there next to be sure we don't have any regressions.
Ok I can repro all that stuff on |
😌 , do you want me to have a look at those other problems you found? |
I would do something like:
|
Sure, to get there with an unverified account you have to do the OldDot -> NewDot flow, right? |
Yep! Left a comment here about this -> https://github.com/Expensify/Web-Secure/pull/2042#issuecomment-926155516 |
Cool, I didn't know exactly how to get there, those steps help :) |
|
Going to CP this but let's make sure to update steps and test the unvalidated flow on staging |
…error Return to the correct sub step in VBA flow after error in adding Bank Account manually (cherry picked from commit b05a7a7)
yes yes, sorry for the slowness on that.. I'm still struggling to get from OldDot to NewDot Following @robertjchen 's PR steps, after "Select Expensify Card option ONLY in WelcomeBusiness inbox task", I see this, what then 🤷 I tried a few options, but I haven't been able to see something that takes me to new Dot. If I just try to load NewDot using localhost:8080, I cannot log in because the account is not verified. I'm missing how to do the "start the VBA flow" part. |
Just saw that if I open it with a small screen (mobile), I see a button that takes me to NewDot :) |
Update: Added the "unverified account error" to the test / QA. |
🚀 Cherry-picked to staging by @marcaaron in version: 1.1.1-8 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
It was decided that this is a blocker for n6, so a hold won't apply here. |
I was able to test this successfully! Can we check it off @applausebot @isagoico ? |
🚀 Deployed to staging by @marcaaron in version: 1.1.1-9 🚀
|
cc @marcaaron: copying Mark here because he may know the reason why we are copying this value to a local state.
Details
The subStep (
reimbursementAccount.achData.subStep
) in the VBA flow was being copied from Onyx into a local state in theBankAccountStep
component (here). Then, when renderingBankAccountStep
, we read thesubStep
usingthis.state.bankAccountAddMethod
(i.e. here).The problem with this approach is that we have now to sources of truth for the
subStep
:reimbursementAccount.achData.subStep
)This can potentially cause bugs when these states are not synchronized properly.
I this case:
BankAccountStep
, we just update thesubStep
in the local state (here), Onyx doesn't know about this update.reimbursementAccount.loading
totrue
in Onyx (here)reimbursementAccount.loading
withtrue
value in Onyx will make the loading indicator appear (here), destroying theBankAccountStep
and its local state.reimbursementAccount.loading
is set tofalse
hereReimbursementAccountPage
removesVBALoadingIndicator
and createsBankAccountStep
step again.BankAccountStep
copies again thesubStep
to its local state (constructor called again). ThesubStep
isnull
at this point.There can be more than one approach to solve this, but here I'll mention two:
The implementation I'm trying to do is (1.) because in my experience dealing with states that get copied and have to be updated together makes things more complex, and I prefer to avoid it if possible. It can cause bugs like this that are not so easy to catch and it is hard to see all cases where things could become unsynchronized .
When clearing the
subStep
from Onyx, I was only able to do so setting it tonull
. Setting it toundefined
didn't do anything.Fixed Issues
$ #5028
Tests AND QA
Case 1: Invalid routing number error
12312312344
123
Expected results:
Case 2: Unverified account error
Expected results
Tested On
Web
Mobile Web
Desktop
iOS
Android
Screenshots
Web
Mobile Web
Desktop
iOS
Android