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-08-28] [$1000] There is Console log error when pressing ESC key while Composer is focused #24232

Closed
1 of 6 tasks
kavimuru opened this issue Aug 7, 2023 · 33 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

@kavimuru
Copy link

kavimuru commented Aug 7, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

PRECONDITION: Open Console log tool to capture console log
CASE 1:

  1. Login to any account.
  2. Press ESC key right after logged-in
  3. Observe: A console log error occurs.
    CASE 2:
  4. Click to open any chat report
  5. Click on the Composer to focus on it (if not focused yet).
  6. Press the ESC key.
  7. 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

Console-Log-Error-ESC.mp4
Recording.5767.mp4

Expensify/Expensify Issue URL:
Issue reported by: @tranvantoan-qn
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690914978662509

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01751354c92045a580
  • Upwork Job ID: 1688663520088018944
  • Last Price Increase: 2023-08-14
  • Automatic offers:
    • tienifr | Contributor | 26135709
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 7, 2023
@melvin-bot
Copy link

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

@jeet-dhandha
Copy link
Contributor

Proposal

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

  • Error is logged when pressing escape just after logging in.

What is the root cause of that problem?

  • The modal is setting null for first time when subscribing to onyx store after logging in.

let modal = {};
this.unsubscribeOnyxModal = onyxSubscribe({
key: ONYXKEYS.MODAL,
callback: (modalArg) => {
modal = modalArg;
},
});

  • Thus its throwing error when pressing escape just after logging in.

this.unsubscribeEscapeKey = KeyboardShortcut.subscribe(
shortcutConfig.shortcutKey,
() => {
if (modal.willAlertModalBecomeVisible) {
return;
}
Navigation.dismissModal();
},

Video For Logs
3bdd25bc-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) => {
+       if (!modalArg) {
+           return;
+       }
        modal = modalArg;
    },
});
  • Thus not setting it null.

What alternative solutions did you explore? (Optional)

  • We can try to find cause why is it setting null for first time.

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Aug 7, 2023
@melvin-bot melvin-bot bot 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 Aug 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 7, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01751354c92045a580

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

melvin-bot bot commented Aug 7, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 7, 2023

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

@tienifr
Copy link
Contributor

tienifr commented 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.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

[ONYXKEYS.MODAL]: {
    isVisible: false,
    willAlertModalBecomeVisible: false,
}

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)

We can modify this line

to

modal = modalArg || {};

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

willAlertModalBecomeVisible = lodashGet(modalArg, 'willAlertModalBecomeVisible', false);

@jeet-dhandha
Copy link
Contributor

jeet-dhandha commented Aug 9, 2023

Proposal [UPDATED] => (#24232 (comment))

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

  • Error is logged when pressing escape just after logging in.

What is the root cause of that problem?

  • The modal is setting null for first time when subscribing to onyx store after logging in.

let modal = {};
this.unsubscribeOnyxModal = onyxSubscribe({
key: ONYXKEYS.MODAL,
callback: (modalArg) => {
modal = modalArg;
},
});

  • 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.)

this.unsubscribeEscapeKey = KeyboardShortcut.subscribe(
shortcutConfig.shortcutKey,
() => {
if (modal.willAlertModalBecomeVisible) {
return;
}
Navigation.dismissModal();
},

Video For Logs
3bdd25bc-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.
  • CONST.js
DEFAULT_MODAL_DATA: {isVisible: false, willAlertModalBecomeVisible: false}
  • setup.js
[ONYXKEYS.MODAL]: CONST.DEFAULT_MODAL_DATA,

@jeet-dhandha
Copy link
Contributor

Updated descriptions and added extra comment for showing why early return instead of modalArg || {}

@melvin-bot melvin-bot bot added the Overdue label Aug 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 10, 2023

@puneetlath, @eVoloshchak Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@puneetlath
Copy link
Contributor

@eVoloshchak thoughts on the proposals?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 14, 2023

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

@eVoloshchak

This comment was marked as outdated.

@melvin-bot melvin-bot bot removed the Overdue label Aug 14, 2023
@eVoloshchak
Copy link
Contributor

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.

I can consistently reproduce only CASE 1 by repeatedly pressing esc after sign in. A console log error appears every time the ESC key is pressed. I don't see this, a console error appears only once

@jeet-dhandha's proposal does resolve this issue, but only this specific issue in SidebarLinks.js, while @tienifr's proposal is more universal and resolves this for all usages (current or future)
I think we should proceed with @tienifr's proposal

🎀👀🎀 C+ reviewed!

@melvin-bot
Copy link

melvin-bot bot commented Aug 14, 2023

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

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

melvin-bot bot commented Aug 15, 2023

📣 @eVoloshchak Please request via NewDot manual requests for the Reviewer role ($1000)

@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer 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 Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 15, 2023
@tienifr
Copy link
Contributor

tienifr commented Aug 15, 2023

The PR is ready for review #24567

@melvin-bot
Copy link

melvin-bot bot commented Aug 16, 2023

🎯 ⚡️ Woah @eVoloshchak / @tienifr, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @tienifr got assigned: 2023-08-15 16:26:37 Z
  • when the PR got merged: 2023-08-16 14:23:38 UTC

On to the next one 🚀

@tranvantoan-qn
Copy link

tranvantoan-qn commented Aug 21, 2023

@puneetlath
It appears that the GH workflow didn't work for me, as I didn't receive the offer automatically.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 21, 2023
@melvin-bot melvin-bot bot changed the title [$1000] There is Console log error when pressing ESC key while Composer is focused [HOLD for payment 2023-08-28] [$1000] There is Console log error when pressing ESC key while Composer is focused Aug 21, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.55-8 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-28. 🎊

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:

  • 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 Aug 21, 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:

  • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] Determine if we should create a regression test for this bug.
  • [@eVoloshchak] 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
Copy link
Contributor

@eVoloshchak friendly reminder on the checklist so that I can pay on monday. Thanks!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Aug 28, 2023
@puneetlath
Copy link
Contributor

@eVoloshchak bump on the checklist!

@eVoloshchak
Copy link
Contributor

  • 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
Copy link
Contributor

@tranvantoan-qn can you please apply to the Upwork job? https://www.upwork.com/jobs/~01751354c92045a580

@puneetlath
Copy link
Contributor

puneetlath commented Aug 29, 2023

Payment summary:

  • External issue reporter @tranvantoan-qn (paid via Upwork) $250
  • Contributor that fixed the issue @tienifr (paid via Upwork) $1500
  • Contributor+ that helped on the issue and/or PR @eVoloshchak (to be paid via NewDot) $1500

@eVoloshchak can you create a manual request in NewDot and then ping me here when you have?

@eVoloshchak
Copy link
Contributor

@puneetlath, created the payment request

@tranvantoan-qn
Copy link

@puneetlath
I've applied for the job, thank you!

@JmillsExpensify
Copy link

@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
Copy link

Reviewed the details for @eVoloshchak. $1,500 approved for payment via NewDot.

@puneetlath
Copy link
Contributor

My apologies! Added.

Thanks everyone!

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

7 participants