-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Profile - The error message is not triggered right after entering an invalid symbol #23743
Comments
Triggered auto assignment to @alexpensify ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.The app doesn't instantly show an error when invalid input is entered in the Profile fields, but waits until the user interacts with another field or hits "Save". What is the root cause of that problem?The form validation currently triggers onBlur or on form submission, not during input changes. Lines 300 to 341 in cd09dc9
What changes do you think we should make in order to solve the problem?We should adjust the form component to validate the input onChange. This change would involve using a similar approach as the existing onBlur validation but triggered on input changes. Please note that this is a rough solution and the actual implementation may require additional adjustments.
|
ProposalPlease re-state the problem that we are trying to solve in this issue.The error message is not triggered right after entering an invalid symbol What is the root cause of that problem?Inputs are only validated after they are "touched", which currently happens when blurring the input or submitting the form. Lines 318 to 320 in cd09dc9
What changes do you think we should make in order to solve the problem?Inside onInputChange: (value, key) => {
const inputKey = key || inputID;
+ setTouchedInput(inputID);
setInputValues((prevState) => {
... Line 321 in cd09dc9
What alternative solutions did you explore? (Optional)Touch the input onFocus, however this may not be desired. Validation makes most sense when an input change occurs. |
A regression from #23306 where we tried to prevent error was cleared from server when switching tab by comparing the value from lastValidatedValues with currentInputValues, but ProposalPlease re-state the problem that we are trying to solve in this issue.Web - Bank - Error message 'bank account should end with 1111' disappears after switching tab What is the root cause of that problem?We always call validate function again when ever input is blurred: Lines 287 to 295 in 5997357
Let take a look at our onValidate function, as we can see it always clear the server error which caused this issue:Line 117 in 5997357
What changes do you think we should make in order to solve the problem?That make senses to clear server errors when input changed but when input is blurred we should keep the server errors. const hasServerError = useMemo(() => Boolean(props.formState) && !_.isEmpty(props.formState.errors), [props.formState]); Also update our const onValidate = useCallback(
(values, shouldClearServerError = true) => {
// other codes
if (shouldClearServerError) {
FormActions.setErrors(props.formID, null);
} Finally update our onBlur: (event) => {
// We delay the validation in order to prevent Checkbox loss of focus when
// the user are focusing a TextInput and proceeds to toggle a CheckBox in
// web and mobile web platforms.
setTimeout(() => {
setTouchedInput(inputID);
onValidate(inputValues, !hasServerError);
}, 200); What alternative solutions did you explore? (Optional)If we can synchronize the validation of account number between client and server then we can avoid this issue. Result:Screen.Recording.2023-06-29.at.07.18.43.mov |
Working on a fix for this regression from issue #21838 |
FYI a PR to fix this regression is awaiting review @alexpensify |
I ran out of time yesterday and am OOO today. I'll try to review it over the weekend. |
Seems like I was a bit unclear - I didn't mean that you should review that
PR, rather that this issue can be put on hold as a fix is on the way. Have
a nice weekend!
…On Fri, Jul 28, 2023, 10:52 PM Al Garces ***@***.***> wrote:
I ran out of time yesterday and am OOO today. I'll try to review it over
the weekend.
—
Reply to this email directly, view it on GitHub
<#23743 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBAWPF2QD2OFPB6AFJ2KEMDXSQRABANCNFSM6AAAAAA22JOJVY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Sorry @joh42 - I missed your comment. Please keep me posted if this bug is still around after the fix is live. |
@joh42 - it looks like the PR went to staging yesterday, can you confirm if we can close this one out? Thanks! |
Thanks for the ping, this can be closed now @alexpensify Screen.Recording.2023-08-02.at.19.40.50.mov |
Perfect, thank you for that update! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
The error is displayed as soon as the invalid symbol or word is entered.
Actual Result:
The error is triggered after the user starts entering info in the other field or hits "Save" if the invalid symbol is in the last name field. After emptying fields, the error is shown as soon as the invalid symbol is entered.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.46
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug6143469_IMG_0720.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
The text was updated successfully, but these errors were encountered: