-
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
Highlight all errors together in BankAccount step #5041
Conversation
Support highlighting multiple errors Only disable submit button if there are empty fields Clear error of field being edited
Sorry, making this [WIP] again because I didn't consider the case of the error coming from the server. |
Update: When the backend returns a validation error for the 'Routing number' we highlight correctly the field again. |
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.
This looks great! I just had mostly style things to add + a question about how we should handle the Onyx workaround.
src/libs/actions/BankAccounts.js
Outdated
@@ -822,7 +832,7 @@ function setupWithdrawalAccount(data) { | |||
} | |||
|
|||
function hideBankAccountErrors() { | |||
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {error: '', existingOwnersList: ''}); | |||
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {error: '', existingOwnersList: '', errors: {}}); |
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.
Probably you'll get conflicts if my other PR is merged, but I noticed that existingOwnersList
isn't actually used anywhere but existingOwners
is - so let's make sure this bug doesn't get reintroduced here.
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.
Should I change existingOwnersList
for existingOwners
now? or we handle it once there is conflict?
I didn't know you could do a search like that in Github, cool feature.
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 guess it doesn't matter yet, but just pointing out the code you have here does nothing so probably we should update it.
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.
Are we actually clearing the errors if we do errors: {}
? This will need to be errors: null
I think?
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.
Are we actually clearing the errors if we do
errors: {}
? This will need to beerrors: null
I think?
You are right, I was clearing this the wrong way. 🤦 How does it work in the case of arrays? do they get merged (concatenated) or replaced?
The answer: the old array gets replaced by the new array (no merging/concatenating)
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.
Actually, I'm just going to set it to null
and the will clear the key. When we get the errors we get them using lodashGet(this.props, ['reimbursementAccount', 'errors'], {})
. I feel like setting this to null
and then {}
is uglier and doesn't make things much better.
Update: pushed some changes addressing comments |
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.
LGTM
Gonna merge this so we can keep the ball rolling. I'm going to spend some time looking into the Onyx improvement. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @marcaaron in version: 1.0.93-2 🚀
|
🚀 Deployed to production by @yuwenmemon in version: 1.0.94-1 🚀
|
cc @marcaaron
Brought some of the functionality implemented in this dead PR
Details
Changes:
Account Number
These changes apply only to BankAccount step in VBA flow.
Fixed Issues
$ #4785
Tests AND QA Steps
/bank-account
by selecting the workspace and tapping the "Get Started" buttonConnect manually
Routing number
, i.e.:1
(front-end validation)Account number
, i.e.:1
(front-end validation)Please double check any highlighted fields and try again.
and see both fields with inline highlighted errors33333332234
asRouting number
and111
as theAccount number
Routing number
and the error modal with the generic message.Screen.Recording.2021-09-02.at.5.50.11.PM.mov
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android