App: [HOLD for payment 2023-10-09] [$500] After Logout, using CMD + J only generates 2 shortcuts in the pop-up (instead of the full list)

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. sign-out if you are logged in.
  2. press cmd+j to open shortcut modal without page reload.
  3. now you see list off all shortcuts in modal.

Expected Result:

only ESC and Shortcut(" CMD+J") keys should be shown

Actual Result:

All Shortcuts are shown here Platforms: MacOS / Chrome / Safari

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.64-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: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation

https://github.com/Expensify/App/assets/43996225/86624327-4448-4829-91a5-9ac15b28895b

Snip - New Expensify - Google Chrome (5)

Expensify/Expensify Issue URL: Issue reported by: @Charan-hs Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692612279461809

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0124cd08463cfd5f26
  • Upwork Job ID: 1699578589047709696
  • Last Price Increase: 2023-09-15
  • Automatic offers:
    • ntdiary | Reviewer | 26826364
    • Charan-hs | Contributor | 26826367
    • Charan-hs | Reporter | 26826368

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 49 (32 by maintainers)

Most upvoted comments

I agree with holding this; the result will be better after merging the PR on #26809.

@Charan-hs - paying now. For future reference, there’s no need to submit work for review. Thanks!

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:

  • [@ntdiary] The PR that introduced the bug has been identified. Link to the PR: N/A
  • [@ntdiary] 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
  • [@ntdiary] 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: No need
  • [@ntdiary] Determine if we should create a regression test for this bug. No need
  • [@ntdiary] 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. No need
  • [@jliexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

Not a regression, just a tiny feature polish, don’t need a regression test. : )

🎯 ⚡️ Woah @ntdiary / @Charan-hs, 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 @Charan-hs got assigned: 2023-09-23 01:48:12 Z
  • when the PR got merged: 2023-09-27 00:21:41 UTC

On to the next one 🚀

I don’t know why I was auto-assigned to the PR 🤔

@jasperhuangg I unassigned myself and assigned you as the reviewer of the PR 🙇

📣 @Charan-hs 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link Upwork job

📣 @Charan-hs 🎉 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 📖

Their proposal makes sense to me! Assigned

@Charan-hs it’ll be @jasperhuangg who assigns you, not me!

@Charan-hs’s proposal makes sense to me, I think we can move forward with their proposal. : )

🎀 👀 🎀 C+ reviewed

Hi, @Charan-hs, perhaps we can just use delete documentedShortcuts[displayName]. Also, some small questions:

  • When subscribing a key, adding documentedShortcuts is conditional, so when unsubscribing, should we consider this condition?
  • The value of eventHandlers[displayName] is array, do we need to distinguish who added the value to documentedShortcuts?

FYI, It seems that using just delete documentedShortcuts[displayName] works well too.

I think this is a call for @ntdiary and @mollfpr to make!

@ishpaul777 Thank you for bringing this to our attention. However, I would like to inform you that this issue is already being addressed and worked on at the moment.https://github.com/Expensify/App/issues/25448

Proposal by @Charan-hs

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

All keyboard shortcut shows up in modal after Logout

What is the root cause of that problem?

When we are logged in or logged out we are unsubscribing the event handlers here. https://github.com/Expensify/App/blob/fdcae9ff99696a1ac6068efbfe8927e1bcf108b7/src/libs/KeyboardShortcut/index.js#L83-L87 but When unsubscribing, we remove event listeners but not shortcuts from the variable documentedShortcuts. Even though I have unsubscribed, the shortcuts are still present in documentedShortcuts.

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

Here, https://github.com/Expensify/App/blob/fdcae9ff99696a1ac6068efbfe8927e1bcf108b7/src/libs/KeyboardShortcut/index.js#L83-L87 When unsubscribed we can remove the values present in documentedShortcuts by displayname (key).

    lodashUnset(documentedShortcuts,displayName);
//or
    documentedShortcuts = _.omit(documentedShortcuts,displayName);
//or
   documentedShortcuts[displayName] = {} // here we can return null or {}
//We can use the delete method also based on your request.

What alternative solutions did you explore? (Optional)