Skip to content
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

[HOLD on #23780 & #23780] Web - Routing number field doesn't give an error util user type something into Account number field #23789

Closed
1 of 6 tasks
kbecciv opened this issue Jul 28, 2023 · 8 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Jul 28, 2023

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:

  1. Open website > Settings
  2. Click on Workkspaces > Bank Account (It takes us to Connect bank account Step 1 of 5)
  3. Type something to first field and get the cursor to second one. Here first input doesn't give us error till we start typing on the second field.

Expected Result:

Routing number field should't give an error whenever user focus out of it

Actual Result:

Routing number field doesn't give an error util user type something into Account number field

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.47-2
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

screen-capture.56.webm
Recording.3962.mp4

Expensify/Expensify Issue URL:
Issue reported by: @MahmudjonToraqulov
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690519501033259

View all open jobs on GitHub

@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@s-alves10
Copy link
Contributor

s-alves10 commented Jul 28, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Routing number field doesn't show an error until user types something in account number

What is the root cause of that problem?

Here is our validation logic when blur event occurs.

App/src/components/Form.js

Lines 305 to 311 in d9cf222

setTouchedInput(inputID);
// To prevent server errors from being cleared inadvertently, we only run validation on blur if any form values have changed since the last validation/submit
const shouldValidate = !_.isEqual(inputValues, lastValidatedValues.current);
if (shouldValidate) {
onValidate(inputValues);
}

As you can see, if the last validated values are the same as the current values, we don't validate again though touchedInputs flag changes.

When a user types in routing number field, validation is done and the form values is stored in lastValidatedValues.current. On blur event, we set touched flag for the routing number and try to validate but the form values didn't change. That's why validation isn't done.

This is the root cause

What changes do you think we should make in order to solve the problem?

We need to compare touchedInputs flags as well for checking if we should validate again.
Replace the above code with the following code

        // To prevent server errors from being cleared inadvertently, we only run validation on blur if any form values have changed since the last validation/submit
        const shouldValidate = !_.isEqual(inputValues, lastValidatedValues.current) || !touchedInputs.current[inputID];
        setTouchedInput(inputID);
        if (shouldValidate) {
            onValidate(inputValues);
        }

This works as expected

Result
23789.mp4

What alternative solutions did you explore? (Optional)

@Pujan92
Copy link
Contributor

Pujan92 commented Jul 28, 2023

Seems regression from #23306

@joh42
Copy link
Contributor

joh42 commented Jul 28, 2023

Thanks for letting me know Pujan92. Same bug as #23743. A PR that solves this is waiting to be reviewed #23780

@twisterdotcom twisterdotcom changed the title Web - Routing number field doesn't give an error util user type something into Account number field [HOLD on #23780] Web - Routing number field doesn't give an error util user type something into Account number field Jul 28, 2023
@twisterdotcom twisterdotcom added Weekly KSv2 and removed Daily KSv2 labels Jul 28, 2023
@joh42
Copy link
Contributor

joh42 commented Jul 28, 2023

Also just to be clear, this issue is a duplicate of #23743, which was created roughly 12 hours before this issue was reported in Slack.

@twisterdotcom twisterdotcom changed the title [HOLD on #23780] Web - Routing number field doesn't give an error util user type something into Account number field [HOLD on #23780 & #23780] Web - Routing number field doesn't give an error util user type something into Account number field Jul 31, 2023
@joh42
Copy link
Contributor

joh42 commented Aug 2, 2023

The PR fixing this regression has been deployed to staging now @twisterdotcom

Screen.Recording.2023-08-02.at.19.47.50.mov

Again, this issue was a dupe of #23743

@melvin-bot melvin-bot bot added the Overdue label Aug 7, 2023
@twisterdotcom
Copy link
Contributor

Thanks @joh42. closing this now.

@melvin-bot melvin-bot bot removed the Overdue label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2
Projects
None yet
Development

No branches or pull requests

5 participants