You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[PAYMENT DUE MAY 14] [$250] Android - Enter magic code error is displayed simultaneously with incorrect code error #39873
Version Number: 1.4.61-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail:https://expensify.testrail.io/index.php?/tests/view/4483896 Issue reported by: Applause - Internal Team
Action Performed:
Open the app and enter a new account email
Repeat the previous step with the same email to receive two validation links
Tap on ''Sign In''
Navigate to the account email inbox and open the first email of the two
Expected Result:
The error message "Please enter your magic code" should be dismissed, and only the error about the incorrect magic code should be displayed, as the user just used a magic code link that is equivalent to entering a magic cod
Actual Result:
The user encounters the first error message ("Please enter your magic code") despite having just used the expired magic code link (equivalent to a magic code). Both errors regarding incorrect and entering the magic code are displayed simultaneously
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
@isabelastisser FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Please re-state the problem that we are trying to solve in this issue.
There are 2 error message shown, form error and the server validation error.
What is the root cause of that problem?
We have 2 types of the magic code error and both of them are shown. One is from the local form validation and the other one is from the server validation.
Also, I think the code isn't shown in the magic code input is a bit weird.
What changes do you think we should make in order to solve the problem?
Clear the server error when submitting the magic code.
if (account?.errors) {
SessionActions.clearAccountMessages();
}
If we want to show the magic code when using the magic link, we need to save the code optimistically, currently, we do it when the request is successful.
changed the title [-]Android - Enter magic code error is displayed simultaneously with incorrect code error[/-][+][$250] Android - Enter magic code error is displayed simultaneously with incorrect code error[/+]on Apr 10, 2024
Please re-state the problem that we are trying to solve in this issue.
The user encounters the first error message ("Please enter your magic code") despite having just used the expired magic code link (equivalent to a magic code). Both errors regarding incorrect and entering the magic code are displayed simultaneously
The problem here is that when there's invalid magic code, there's server error, and then when the user clicks Sign in, there's client validation error because there's no magic code in the input, thus this will show both errors at the same time.
What changes do you think we should make in order to solve the problem?
Clear the server error when we submit the code, in here
Vice versa, we should also clear the client validation error if the server side error appears, this is because if the client error appears first, then the server side error appears, there'll still be 2 errors showing.
(We can make this more specific by only clearing the form error corresponding to the code screen we're showing, also to run the effect only if hasError changes from false to true)
I think the rest of the UX currently is good, we don't need to show the magic code when using the magic link, because we should let the user be able to type a new code as soon as possible instead of forcing them to delete the invalid code first before entering the new code.
If we want to fix this UX, it's likely out of this issue's scope. To do it, we can save the code optimistically when submitting the request, and update the code in the UI to match that optimistic code we stored from the magic link.
What alternative solutions did you explore? (Optional)
Thanks for proposals everyone, @tienifr do you have a test step to reproduce this bug?
Vice versa, we should also clear the client validation error if the server side error appears, this is because if the client error appears first, then the server side error appears, there'll still be 2 errors showing
The PR that introduced the bug has been identified. Link to the PR: I think it's a new requirement that we haven't covered yet. So no offending PR in this issue.
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: N/A
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: N/A
Determine if we should create a regression test for this bug: NO, it's an edge case and a UI improvement
Activity
melvin-bot commentedon Apr 8, 2024
Triggered auto assignment to @isabelastisser (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.lanitochka17 commentedon Apr 8, 2024
@isabelastisser FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
bernhardoj commentedon Apr 9, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
There are 2 error message shown, form error and the server validation error.
What is the root cause of that problem?
We have 2 types of the magic code error and both of them are shown. One is from the local form validation and the other one is from the server validation.
App/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx
Lines 315 to 321 in 4f67357
Also, I think the code isn't shown in the magic code input is a bit weird.
What changes do you think we should make in order to solve the problem?
Clear the server error when submitting the magic code.
If we want to show the magic code when using the magic link, we need to save the code optimistically, currently, we do it when the request is successful.
App/src/libs/actions/Session/index.ts
Lines 541 to 548 in 4f67357
Then, we need to update this effect so it updates the code every time the
validateCodeis updated and loading.App/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx
Lines 96 to 101 in 4f67357
What alternative solutions did you explore? (Optional)
[-]Android - Enter magic code error is displayed simultaneously with incorrect code error[/-][+][$250] Android - Enter magic code error is displayed simultaneously with incorrect code error[/+]melvin-bot commentedon Apr 10, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01d7b54fd3dba64e10
melvin-bot commentedon Apr 10, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (
External)tienifr commentedon Apr 11, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The user encounters the first error message ("Please enter your magic code") despite having just used the expired magic code link (equivalent to a magic code). Both errors regarding incorrect and entering the magic code are displayed simultaneously
What is the root cause of that problem?
There're 2 places we're showing the error:
The problem here is that when there's invalid magic code, there's server error, and then when the user clicks
Sign in, there's client validation error because there's no magic code in the input, thus this will show both errors at the same time.What changes do you think we should make in order to solve the problem?
We can use similar logic to clear as here.
So we should add here
(We can make this more specific by only clearing the form error corresponding to the code screen we're showing, also to run the effect only if
hasErrorchanges fromfalsetotrue)I think the rest of the UX currently is good, we don't need to show the magic code when using the magic link, because we should let the user be able to type a new code as soon as possible instead of forcing them to delete the invalid code first before entering the new code.
If we want to fix this UX, it's likely out of this issue's scope. To do it, we can save the code optimistically when submitting the request, and update the code in the UI to match that optimistic code we stored from the magic link.
What alternative solutions did you explore? (Optional)
NA
hoangzinh commentedon Apr 14, 2024
Thanks for proposals everyone, @tienifr do you have a test step to reproduce this bug?
isabelastisser commentedon Apr 15, 2024
Bump @tienifr
32 remaining items
isabelastisser commentedon May 13, 2024
Not overdue.
isabelastisser commentedon May 17, 2024
@hoangzinh @marcochavezf can I process the payments? Any regressions?
hoangzinh commentedon May 20, 2024
Yes, please. No regressions so far but wait until I complete the bug zero checklist
hoangzinh commentedon May 20, 2024
BugZero Checklist:
isabelastisser commentedon May 20, 2024
Payment summary:
C+ review @hoangzinh $250, paid in Upwork
Contributor @tienifr $250, paid in Upwork
@tienifr, what's your Upwork profile so I can send the offer? Thanks!
tienifr commentedon May 21, 2024
@isabelastisser Here you are: https://www.upwork.com/freelancers/~01991fd5e5c11ef3ba
isabelastisser commentedon May 21, 2024
Thanks, the offer was sent.
All set!
tienifr commentedon May 21, 2024
@isabelastisser Thanks, I accepted it!