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
[HOLD for payment 2023-08-08] [$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page #23596
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
On login page, enter an email/phone number and click Continue
Enter WRONG Magic code
When the error is showing, hold the left-mouse button and drag over the Magic code field - (like we are selecting text BUT do not show the selection)
Press Backspace/Delete key on the keyboard
Expected Result:
Application should not crash
Actual Result:
Application crashes
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.45-1 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
Please re-state the problem that we are trying to solve in this issue.
We want the app to not crash when backspace key is pressed on the magic code input (after drag select)
What is the root cause of that problem?
When we submit the form (it happens when we fill the last cell of input), then we set the focused index to undefined here.
And next, when we drag over the whole input, the focus event gets triggered, but we don't update the focused and edit index in that event. And next, when we press backspace, the focused index will still be undefined which causes the editIndex to also become undefined, and on blur, this undefined editIndex crashes the app.
What changes do you think we should make in order to solve the problem?
I think we should use a single type for focusedIndex, and not use undefined (we can add -1 in place of that). This is important because eventually, we will be moving to typescript.
So when we blur the input we should set the focused index to -1here.
And on focus event, when focusedIndex is -1, we update the focused index to the current cell index like this
if (focusedIndex == -1) {
setInput('');
setEditIndex(index)
setFocusedIndex(index)
}
and we update the focus event of text input like this
changed the title [-]Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/-][+][$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/+]on Jul 26, 2023
changed the title [-][$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/-][+][HOLD for payment 2023-08-08] [$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/+]on Aug 1, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.48-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-08-08. 🎊
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
Contributor that fixed the issue
Contributor+ that helped on the issue and/or PR
For reference, here are some details about the assignees on this issue:
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:
[@s77rt] The PR that introduced the bug has been identified. Link to the PR:
[@s77rt] 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:
[@s77rt] 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:
[@s77rt] Determine if we should create a regression test for this bug.
[@s77rt] 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.
[@JmillsExpensify / @CortneyOfstad] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
A discussion in #expensify-bugs has been started: I don't think this is needed, the bug was introduced on a commit that was meant to follow another approach, seems like a one time bug.
Determine if we should create a regression test for this bug: No
@tranvantoan-qn was paid the reporting amount of $250 @Pujan92 and @s77rt were both paid $1,500 (contributor and C+ fee, plus bonus due to the PR being merged within 1 day of assignment).
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Jul 25, 2023
Triggered auto assignment to @CortneyOfstad (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 25, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)kbecciv commentedon Jul 25, 2023
Proposal: @tranvantoan-qn
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690254789469459
Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes after pressing Backspace/Delete key in Incorrect magic code page
What is the root cause of that problem?
After dragging, the
editIndexwill be undefined, making it unable to retrieve the object. Unfortunately, in the following code, we did not check for this scenario, which results in an app crash:https://github.com/Expensify/App/blob/main/src/components/MagicCodeInput.js#L105
What changes do you think we should make in order to solve the problem?
To prevent the crash, add the following condition:
huzaifa-99 commentedon Jul 26, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
We want the app to not crash when backspace key is pressed on the magic code input (after drag select)
What is the root cause of that problem?
When we submit the form (it happens when we fill the last cell of input), then we set the focused index to undefined here.
And next, when we drag over the whole input, the focus event gets triggered, but we don't update the focused and edit index in that event. And next, when we press backspace, the focused index will still be undefined which causes the editIndex to also become undefined, and on blur, this undefined editIndex crashes the app.
What changes do you think we should make in order to solve the problem?
I think we should use a single type for focusedIndex, and not use undefined (we can add -1 in place of that). This is important because eventually, we will be moving to typescript.
So when we blur the input we should set the focused index to
-1here.And on focus event, when focusedIndex is
-1, we update the focused index to the current cell index like thisand we update the focus event of text input like this
Now when backspace is pressed, the focusedIndex will be properly defined.
I used
-1to indicate that no cell is focused, we can use any other number value hereFocus event triggers before the press event. We can optimize the state updates in this case
What alternative solutions did you explore? (Optional)
Block the drag selection on the magic code input
[-]Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/-][+][$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/+]melvin-bot commentedon Jul 26, 2023
Job added to Upwork: https://www.upwork.com/jobs/~017414e8528c6cdd44
melvin-bot commentedon Jul 26, 2023
Current assignee @CortneyOfstad is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Jul 26, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (
External)CortneyOfstad commentedon Jul 26, 2023
@s77rt we have a couple of proposals for your review above 👍 TIA!
44 remaining items
[-][$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/-][+][HOLD for payment 2023-08-08] [$1000] Web - App crashes after pressing Backspace/Delete key in Incorrect magic code page[/+]melvin-bot commentedon Aug 1, 2023
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Aug 1, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.48-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-08-08. 🎊
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.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
melvin-bot commentedon Aug 1, 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:
s77rt commentedon Aug 3, 2023
CortneyOfstad commentedon Aug 14, 2023
I am back from OoO, so taking this back over. Thanks @s77rt for the review above!
CortneyOfstad commentedon Aug 14, 2023
Payments have been made!
@tranvantoan-qn was paid the reporting amount of $250
@Pujan92 and @s77rt were both paid $1,500 (contributor and C+ fee, plus bonus due to the PR being merged within 1 day of assignment).
Closing!