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 c+ newdot payment][$1000] Compose box loses focus when reclicking same chat in LHN #23676

Closed
1 of 6 tasks
kavimuru opened this issue Jul 26, 2023 · 46 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jul 26, 2023

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. Open any chat
  2. Notice that the composer is focused
  3. Click on the same chat in LHN. Notice the composer loses focus

Expected Result:

Compose box don't lose focus when Clicking on the same chat in LHN

Actual Result:

Compose box loses focus

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.46-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

Test87.Composerlosefocus-1.mp4
Recording.1360.mp4

Expensify/Expensify Issue URL:
Issue reported by: @daveSeife
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690317170412039

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a795f9206baa2f0c
  • Upwork Job ID: 1684464091337949184
  • Last Price Increase: 2023-08-07
  • 2023-07-27
  • Automatic offers:
    • daveSeife | Reporter | 25800239
    • tienifr | Contributor | 26045509
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

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

@tienifr
Copy link
Contributor

tienifr commented Jul 26, 2023

Proposal

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

App loses focus from compose box on clicking same chat in LHN for the 2nd time

What is the root cause of that problem?

This issue has been fixed previously in #21552 where we prevent opening Report page when re-clicking the active report. Here we retrieved the currentReportID using withCurrentReportID HOC.

showReportPage(option) {
// Prevent opening Report page when clicking LHN row quickly after clicking FAB icon
// or when clicking the active LHN row
// or when continuously clicking different LHNs, only apply to small screen
// since getTopmostReportId always returns on other devices
if (this.props.isCreateMenuOpen || this.props.currentReportID === option.reportID || (this.props.isSmallScreenWidth && Navigation.getTopmostReportId())) {
return;
}
Navigation.navigate(ROUTES.getReportRoute(option.reportID));
this.props.onLinkClick();
}

However after the major refactor in #21406, withCurrentReportID HOC was lifted up to the parent component SidebarLinksData to optimize performance. Unfortunately, the author might have forgotten about the above mentioned line where we relied on currentReportID. Thus it will always be undefined.

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

Lift the check this.props.currentReportID === option.reportID up to SidebarLinksData as a callback:

const isActiveReport = useCallback((option) => currentReportID === option.reportID, [currentReportID]);

Declare proper prop types for SidebarLinks and pass the callback to it.

Update: For the callback, in order not to use currentReportID as a dependency of the callback, which leads to the callback re-render too often, we should save it in a ref instead and update it in a useEffect. We already have a usePrevious for that.

const prevCurrentReportID = usePrevious(currentReportID);
const isActiveReport = useCallback((option) => prevCurrentReportID === option.reportID, [prevCurrentReportID]);

@kadiealexander
Copy link
Contributor

Repro:

2023-07-27_19-21-06.mp4

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Jul 27, 2023
@melvin-bot melvin-bot bot changed the title Compose box loses focus when reclicking same chat in LHN [$1000] Compose box loses focus when reclicking same chat in LHN Jul 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01a795f9206baa2f0c

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

melvin-bot bot commented Jul 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

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

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Jul 27, 2023

@mountiny @hannojg @0xmiroslav Check this proposal. This is a regression from #21406, please take care.

@0xmiros
Copy link
Contributor

0xmiros commented Jul 27, 2023

I can take care

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

melvin-bot bot commented Jul 28, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

📣 @0xmiroslav You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Jul 28, 2023

📣 @daveSeife 🎉 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

@melvin-bot melvin-bot bot added the Overdue label Jul 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

@kadiealexander, @Santhosh-Sellavel, @0xmiroslav Whoops! This issue is 2 days overdue. Let's get this updated quick!

@kadiealexander
Copy link
Contributor

@0xmiroslav @Santhosh-Sellavel any updates?

@melvin-bot melvin-bot bot removed the Overdue label Aug 1, 2023
@0xmiros
Copy link
Contributor

0xmiros commented Aug 1, 2023

There's 1 proposal pending review. I will provide feedback tomorrow.

@hannojg
Copy link
Contributor

hannojg commented Aug 2, 2023

Checking …

@hannojg
Copy link
Contributor

hannojg commented Aug 2, 2023

Every time the current report page would change, the callback would change, and thus the SidebarLinks would re-render as well. The effect would be the same as just passing currentReportID

Here is what we could do instead:

@hannojg
Copy link
Contributor

hannojg commented Aug 2, 2023

We can save the currentReportID in a ref (and update the ref from a useEffect).
Then we create a memoized callback as @tienifr pointed out (minor note: I'd only pass a string as parameter).

For this part

We can save the currentReportID in a ref (and update the ref from a useEffect).

we already have a hook called usePrevious. The full solution would roughly look like this:

function SidebarLinksData({currentReportID}) {
  const currentReportIDRef = usePrevious(currentReportID);
  const isReportActive = useCallback((reportID) => 
     reportID === currentReportIDRef.current,
  // 👀 Notice how the useCallback has no dependency now and thus it reference will stay the same!
  []);

  return (
    <SidebarLinks {...} isReportActive={isReportActive} />
   );
}

@tienifr Feel free to use that to update your proposal 😊

@tienifr
Copy link
Contributor

tienifr commented Aug 2, 2023

Thanks a lot @hannojg for your suggestion! I tested again and updated my proposal.

@kadiealexander
Copy link
Contributor

kadiealexander commented Sep 5, 2023

Thanks @Santhosh-Sellavel!! I can't reproduce anymore, can you?

@tienifr
Copy link
Contributor

tienifr commented Sep 5, 2023

@kadiealexander I've explained in the PR about why we should proceed even though the issue is no longer reproducible.

@kadiealexander
Copy link
Contributor

Thanks @tienifr!!

@melvin-bot
Copy link

melvin-bot bot commented Sep 6, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @tienifr got assigned: 2023-08-10 08:38:26 Z
  • when the PR got merged: 2023-09-06 07:30:47 UTC
  • days elapsed: 18

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 8, 2023
@melvin-bot melvin-bot bot changed the title [Hold for #24619][$1000] Compose box loses focus when reclicking same chat in LHN [HOLD for payment 2023-09-15] [Hold for #24619][$1000] Compose box loses focus when reclicking same chat in LHN Sep 8, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 8, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.65-7 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-09-15. 🎊

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:

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 melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Sep 14, 2023
@MonilBhavsar MonilBhavsar added the Weekly KSv2 label Sep 18, 2023
@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@MonilBhavsar MonilBhavsar removed the Daily KSv2 label Sep 18, 2023
@MonilBhavsar
Copy link
Contributor

Bumping to weekly

@Santhosh-Sellavel
Copy link
Collaborator

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:

@Santhosh-Sellavel
Copy link
Collaborator

@kadiealexander Please leave a payment summary here.

@Expensify Expensify deleted a comment from melvin-bot bot Sep 26, 2023
@kadiealexander kadiealexander changed the title [HOLD for payment 2023-09-15] [Hold for #24619][$1000] Compose box loses focus when reclicking same chat in LHN [HOLD for c+ newdot payment][$1000] Compose box loses focus when reclicking same chat in LHN Sep 26, 2023
@kadiealexander
Copy link
Contributor

kadiealexander commented Sep 26, 2023

Payouts due:

Eligible for 50% #urgency bonus? No

Upwork job is here.

@Santhosh-Sellavel
Copy link
Collaborator

Requested on ND

@melvin-bot melvin-bot bot added the Overdue label Oct 5, 2023
@kadiealexander
Copy link
Contributor

Not overdue.

@melvin-bot melvin-bot bot removed the Overdue label Oct 6, 2023
@Santhosh-Sellavel
Copy link
Collaborator

I got paid lets close this one, thanks!

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants