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-28] [$1000] There is Console log error when pressing ESC key while Composer is focused #24232
PRECONDITION: Open Console log tool to capture console log
CASE 1:
Login to any account.
Press ESC key right after logged-in
Observe: A console log error occurs.
CASE 2:
Click to open any chat report
Click on the Composer to focus on it (if not focused yet).
Press the ESC key.
Observe: A console log error occurs.
Expected Result:
There should be no console log error.
Actual Result:
A console log error appears every time the ESC key is pressed.
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
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.50.3 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
changed the title [-]There is Console log error when pressing ESC key while Composer is focused[/-][+][$1000] There is Console log error when pressing ESC key while Composer is focused[/+]on Aug 7, 2023
Please re-state the problem that we are trying to solve in this issue.
A console log error appears every time the ESC key is pressed.
What is the root cause of that problem?
We're not initializing the default value of the ONYXKEYS.MODAL on app start up so it's null for the first time. This causes the error here when we access it properties. It will have value when the Modal or PopoverWithoutOverlay are mounted, which set its value (as in here).
So it's a race condition and hard to reproduce, we should press ESC very quickly after signing in. For easier reproduction, can comment out this line and this line so the race condition is more visible.
What changes do you think we should make in order to solve the problem?
We should initialize the ONYXKEYS.MODAL on app start up here
This will make sure any future places that will be using onyxSubscribe with ONYXKEYS.MODAL is protected. Also the isVisible and willAlertModalBecomeVisible is now of correct boolean type around the app (no case of undefined)
What alternative solutions did you explore? (Optional)
Cannot just early return since if somehow the value is cleared in the future, the modal value here will not be reset.
Or, since only willAlertModalBecomeVisible is used and no need to store the full modal object, we can use a simple willAlertModalBecomeVisible variable and replace the above line with
Thus it is throwing an error when pressing escape just after logging in. (We need to press 'esc' rapidly after logging in to reproduce the issue. Also this happens only when we logout and login again.)
Video For Logs3bdd25bc-cc6b-4f40-8bfd-0a2f9a771b5a.mp4
What changes do you think we should make in order to solve the problem?
We can add a check for modal before setting it to null.
this.unsubscribeOnyxModal = onyxSubscribe({
key: ONYXKEYS.MODAL,
callback: (modalArg) => {
+ // Using return as we have been using this code typo for other callbacks like in Report.js, ReportActionsUtils.js, etc.+ if (!modalArg) {+ return;+ }
modal = modalArg;
},
});
Hence not setting it null.
What alternative solutions did you explore? (Optional)
We can add default modal data in CONST.js and use it as a default value for modal in setup.js.
The PR that introduced the bug has been identified. Link to the PR: there isn't a PR that introduced this bug, that's how it was implemented initially
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: This is an extremely rare edge case, it's hard to reproduce since it's caused by a race condition and can be reproduced only after login. I don't think there are additional steps we should add, this is a pretty rare type of bug
Determine if we should create a regression test for this bug.
I don't think a regression test is necessary. As stated above, this is a rare edge case, in addition to having zero impact on actual user experience
@puneetlath do you mind adding the amount in the summary above. I see the automated confirmation and I reviewed the PR, though let's make sure we have those for the history.
Activity
melvin-bot commentedon Aug 7, 2023
Triggered auto assignment to @puneetlath (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Aug 7, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)jeet-dhandha commentedon Aug 7, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
App/src/pages/home/sidebar/SidebarLinks.js
Lines 90 to 96 in e716286
App/src/pages/home/sidebar/SidebarLinks.js
Lines 99 to 107 in e716286
Video For Logs
3bdd25bc-cc6b-4f40-8bfd-0a2f9a771b5a.mp4
What changes do you think we should make in order to solve the problem?
this.unsubscribeOnyxModal = onyxSubscribe({ key: ONYXKEYS.MODAL, callback: (modalArg) => { + if (!modalArg) { + return; + } modal = modalArg; }, });null.What alternative solutions did you explore? (Optional)
nullfor first time.[-]There is Console log error when pressing ESC key while Composer is focused[/-][+][$1000] There is Console log error when pressing ESC key while Composer is focused[/+]melvin-bot commentedon Aug 7, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01751354c92045a580
melvin-bot commentedon Aug 7, 2023
Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Aug 7, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (
External)tienifr commentedon Aug 8, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
A console log error appears every time the ESC key is pressed.
What is the root cause of that problem?
We're not initializing the default value of the
ONYXKEYS.MODALon app start up so it's null for the first time. This causes the error here when we access it properties. It will have value when theModalorPopoverWithoutOverlayare mounted, which set its value (as in here).So it's a race condition and hard to reproduce, we should press ESC very quickly after signing in. For easier reproduction, can comment out this line and this line so the race condition is more visible.
What changes do you think we should make in order to solve the problem?
We should initialize the
ONYXKEYS.MODALon app start up hereThis will make sure any future places that will be using
onyxSubscribewithONYXKEYS.MODALis protected. Also theisVisibleandwillAlertModalBecomeVisibleis now of correctbooleantype around the app (no case ofundefined)What alternative solutions did you explore? (Optional)
We can modify this line
App/src/pages/home/sidebar/SidebarLinks.js
Line 94 in 2ce4328
Cannot just early return since if somehow the value is cleared in the future, the
modalvalue here will not be reset.Or, since only
willAlertModalBecomeVisibleis used and no need to store the fullmodalobject, we can use a simplewillAlertModalBecomeVisiblevariable and replace the above line withjeet-dhandha commentedon Aug 9, 2023
Proposal [UPDATED] => (#24232 (comment))
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
App/src/pages/home/sidebar/SidebarLinks.js
Lines 90 to 96 in e716286
App/src/pages/home/sidebar/SidebarLinks.js
Lines 99 to 107 in e716286
Video For Logs
3bdd25bc-cc6b-4f40-8bfd-0a2f9a771b5a.mp4
What changes do you think we should make in order to solve the problem?
this.unsubscribeOnyxModal = onyxSubscribe({ key: ONYXKEYS.MODAL, callback: (modalArg) => { + // Using return as we have been using this code typo for other callbacks like in Report.js, ReportActionsUtils.js, etc. + if (!modalArg) { + return; + } modal = modalArg; }, });null.What alternative solutions did you explore? (Optional)
setup.js.30 remaining items
puneetlath commentedon Aug 28, 2023
@eVoloshchak bump on the checklist!
eVoloshchak commentedon Aug 28, 2023
I don't think a regression test is necessary. As stated above, this is a rare edge case, in addition to having zero impact on actual user experience
puneetlath commentedon Aug 29, 2023
@tranvantoan-qn can you please apply to the Upwork job? https://www.upwork.com/jobs/~01751354c92045a580
puneetlath commentedon Aug 29, 2023
Payment summary:
@eVoloshchak can you create a manual request in NewDot and then ping me here when you have?
eVoloshchak commentedon Aug 29, 2023
@puneetlath, created the payment request
tranvantoan-qn commentedon Aug 29, 2023
@puneetlath
I've applied for the job, thank you!
JmillsExpensify commentedon Aug 30, 2023
@puneetlath do you mind adding the amount in the summary above. I see the automated confirmation and I reviewed the PR, though let's make sure we have those for the history.
JmillsExpensify commentedon Aug 30, 2023
Reviewed the details for @eVoloshchak. $1,500 approved for payment via NewDot.
puneetlath commentedon Aug 31, 2023
My apologies! Added.
Thanks everyone!