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 for payment 2023-06-13] [$1000] Contact Method - Validation error message doesn't disappear upon requesting new magic code #19471

Closed
2 of 6 tasks
kbecciv opened this issue May 23, 2023 · 30 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented May 23, 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!


Issue found when executing PR #19040

Action Performed:

  1. Login to ND.
  2. Go to Settings > Profile > Contact method > New contact method.
  3. Add any contact method.
  4. Once redirected to the Contact method page, click on the contact method you entered.
  5. Enter any random numbers.
  6. Ensure you are shown an error.
  7. Click on the resend magic code text.

Expected Result:

Input is cleared and you are focused on the first input box. Error message should disappear.

Actual Result:

Input is cleared and focused on the first input, but error message still persists requesting a new code and try again.

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.17.0

Reproducible in staging?: Yes

Reproducible in production?: n/a

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

https://platform.applause.com/services/links/v1/external/d3721b2fe38422b24fa746eb47d7892d16fccf9337780c8d13264980a75745e8

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013b03109026ba1aa6
  • Upwork Job ID: 1661075549036351488
  • Last Price Increase: 2023-05-30
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 23, 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

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label May 23, 2023
@melvin-bot melvin-bot bot changed the title Contact Method - Validation error message doesn't disappear upon requesting new magic code [$1000] Contact Method - Validation error message doesn't disappear upon requesting new magic code May 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

Job added to Upwork: https://www.upwork.com/jobs/~013b03109026ba1aa6

@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 23, 2023

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

@Pujan92
Copy link
Contributor

Pujan92 commented May 23, 2023

Proposal

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

Validation error message doesn't disappear upon requesting new magic code

What is the root cause of that problem?

While requesting the new magic code we are not cleaning the previous error in the onyx which seems the cause for the issue.

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

Add a line to reset errorField validateLogin null also here in onyx while requesting a new magic code.
validateLogin: null

errorFields: {
validateCodeSent: null,
},

IMO, we should clear and refocus the input magic code and clear the error as soon as user presses "Resend Magic Code". And show "Link has been re-sent" message only after user receives the api response.

To fix the above point from this comment we need to clear the validate code field and focus the same we need below two functions call required within resendValidateCode.

setValidateCode('');
inputValidateCodeRef.current.focus();
Result https://github.com/Expensify/App/assets/14358475/31610824-7b99-4551-a14a-5a5c77c6aa58

@dummy-1111
Copy link
Contributor

dummy-1111 commented May 24, 2023

Proposal

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

Validation error message doesn't disappear when requesting new magic code

What is the root cause of that problem?

The validation error message is passed to this component as errors props

<OfflineWithFeedback
pendingAction={lodashGet(loginData, 'pendingFields.validateLogin', null)}
errors={ErrorUtils.getLatestErrorField(loginData, 'validateLogin')}
errorRowStyles={[styles.mt2]}
onClose={() => User.clearContactMethodErrors(props.contactMethod, 'validateLogin')}
>

Here ErrorUtils.getLatestErrorField(loginData, 'validateLogin') get errors from loginData['errorFields']['validateLogin] as you can see below

const errorsForField = lodashGet(onyxData, ['errorFields', fieldName], {});

loginData is from props loginList and loginList is from Onyx store with key ONYXKEYS.LOGIN_LIST as you can see below

const loginData = props.loginList[props.contactMethod];

loginList: {
key: ONYXKEYS.LOGIN_LIST,
},

The root cause of this issue is here. We only set validateCodeSent of errorFields when requesting magic code, but the error message comes from validateLogin of errorFields.

{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.LOGIN_LIST,
value: {
[contactMethod]: {
validateCodeSent: false,
errorFields: {
validateCodeSent: null,
},
pendingFields: {
validateCodeSent: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
},
},
},

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

We need to reset the validateLogin of errorFields when requesting magic code.
Replace the below code

errorFields: {
validateCodeSent: null,
},

with

   errorFields: {
     validateCodeSent: null,
     validateLogin: null,
   },

And add the following code here

const resendValidateCode = () => {
User.requestContactMethodValidateCode(props.contactMethod);
};

        setValidateCode('');
        inputValidateCodeRef.current.clear();

And the following code isn't needed and remove it.

useEffect(() => {
if (!props.hasMagicCodeBeenSent) {
return;
}
setValidateCode('');
inputValidateCodeRef.current.clear();
}, [props.hasMagicCodeBeenSent]);

This works perfectly

Mac Chrome
mac_chrome_19471.mp4

What alternative solutions did you explore? (Optional)

@sobitneupane
Copy link
Contributor

@puneetlath Can you please clarify the expected output?

As of now, when user presses "Resend Magic Code", only after receiving api response, "Link has been re-sent" message is displayed and input in cleared.

So, would we expect the error to be cleared as soon as the user presses "Resend Magic Code"?

IMO, we should clear and refocus the input magic code and clear the error as soon as user presses "Resend Magic Code". And show "Link has been re-sent" message only after user receives the api response.

@melvin-bot melvin-bot bot added the Overdue label May 25, 2023
@puneetlath
Copy link
Contributor

@sobitneupane I agree with that. That sounds good.

@melvin-bot melvin-bot bot removed the Overdue label May 25, 2023
@sobitneupane
Copy link
Contributor

@Pujan92 Would you like to update your proposal to yield this outcome?

@dummy-1111
Copy link
Contributor

@sobitneupane
My proposal has already the result. Did you check?

@Pujan92
Copy link
Contributor

Pujan92 commented May 26, 2023

@Pujan92 Would you like to update your proposal to yield this outcome?

@sobitneupane I just updated my proposal.

@dummy-1111
Copy link
Contributor

Proposal

Updated

@melvin-bot melvin-bot bot added the Overdue label May 29, 2023
@sobitneupane
Copy link
Contributor

Proposal from @Pujan92 looks good to me.

🎀👀🎀 C+ reviewed
cc: @puneetlath

@melvin-bot melvin-bot bot removed the Overdue label May 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

📣 @Pujan92 You have been assigned to this job by @puneetlath!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 1, 2023
@Pujan92
Copy link
Contributor

Pujan92 commented Jun 1, 2023

@sobitneupane @puneetlath PR is ready for review!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 6, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Contact Method - Validation error message doesn't disappear upon requesting new magic code [HOLD for payment 2023-06-13] [$1000] Contact Method - Validation error message doesn't disappear upon requesting new magic code Jun 6, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.24-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-06-13. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter n/a
  • Contributor that fixed the issue @Pujan92
  • Contributor+ that helped on the issue and/or PR @sobitneupane

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@sobitneupane] 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] 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.
  • [@puneetlath] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@puneetlath puneetlath removed their assignment Jun 8, 2023
@puneetlath puneetlath added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Jun 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 8, 2023

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 8, 2023
@melvin-bot

This comment was marked as outdated.

@puneetlath
Copy link
Contributor

Sent Upwork hiring offers.

@lschurr adding you for payment since I'll be OOO next week. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Jun 12, 2023
@lschurr
Copy link
Contributor

lschurr commented Jun 12, 2023

Not overdue. This will be paid tomorrow.

@sobitneupane
Copy link
Contributor

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

#15751

  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

#15751 (comment)

  • [@sobitneupane] 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:

https://expensify.slack.com/archives/C049HHMV9SM/p1686632713430389

@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Click on Settings -> Profile -> Contact Method
  2. Either add a new contact method or select the existing one where verification is yet to be done
  3. Enter incorrect magic code
  4. Click on "Resend magic code"
  5. Verify the error and the existing code gets cleared as soon as "Resend magic code" is clicked.

Do we agree 👍 or 👎

@lschurr
Copy link
Contributor

lschurr commented Jun 13, 2023

Cool - these have been paid. I'll create a GH for a new regression test today.

@lschurr
Copy link
Contributor

lschurr commented Jun 13, 2023

All set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants