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 2024-07-22] [$250] Improve ReportScreen rendering time #44925

Closed
mountiny opened this issue Jul 5, 2024 · 12 comments
Closed
Assignees
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers 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

@mountiny
Copy link
Contributor

mountiny commented Jul 5, 2024

Problem

The Profiler indicates that the ReportScreen render time gets re-rendered dozens of times, with each re-rendering taking an average of 599.8ms.

The most current problems are with this hook:

const lastAccessedReportID = useLastAccessedReportID(!!route.params.openOnAdminRoom);

In this PR we’ve introduced the above hook and there might be several problems with it:

  1. We are calculating lastAccessedReportID in each re-render, however, we only require it in one particular scenario: when the route.params.reportID is empty,
  2. The useLastAccessedReportID hook is heavy, due to the poor performance of the ReportUtils.findLastAccessedReport function. This issue existed before the introduction of the PR mentioned.

Solution

Ad 1.
We should calculate the lastAccessedReportID only when needed, that means only once, and only when route.params.reportID is empty (code). This value is used to determine which chat we should show to the user when the user accesses the website without reportID in the URL. POC

Ad 2.
After diving deep into the code I’ve discovered that we sort a whole array of reports just to get one, the most recent, report. We can replace this sort with lodashMaxBy, as we do not (from my analysis) need to sort all reports (needs confirmation). POC

cc @kosmydel

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0109e0b5642eb1863c
  • Upwork Job ID: 1809262837407973619
  • Last Price Increase: 2024-07-05
  • Automatic offers:
    • ikevin127 | Reviewer | 103028165
Issue OwnerCurrent Issue Owner: @zanyrenney
@mountiny mountiny added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. AutoAssignerNewDotQuality Used to assign quality issues to engineers labels Jul 5, 2024
@mountiny mountiny self-assigned this Jul 5, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

Current assignee @mountiny is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new.

Copy link

melvin-bot bot commented Jul 5, 2024

Triggered auto assignment to @zanyrenney (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Jul 5, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0109e0b5642eb1863c

@melvin-bot melvin-bot bot changed the title Improve ReportScreen rendering time [$250] Improve ReportScreen rendering time Jul 5, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 5, 2024
Copy link

melvin-bot bot commented Jul 5, 2024

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

@mountiny mountiny removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 5, 2024
@kosmydel
Copy link
Contributor

kosmydel commented Jul 5, 2024

Hey, I’m from Software Mansion and I will take care of this issue :)

Copy link

melvin-bot bot commented Jul 8, 2024

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

Offer link
Upwork job

@melvin-bot melvin-bot bot added the Overdue label Jul 8, 2024
@mountiny
Copy link
Contributor Author

mountiny commented Jul 8, 2024

A discussed in Slack, please try to split this up to two PRs

Copy link

melvin-bot bot commented Jul 10, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@ikevin127
Copy link
Contributor

⚠️ Automation failed here -> this should be on [HOLD for Payment 2024-07-22] according to today's production deploy from #44948 (comment) and #44955 (comment).

I'm the only one requiring payment here for reviewing PRs #44948 and #44955. Additionally, 1 regression was reported above, therefore bounty payment shoud be adjusted to match that - waiting for regression confirmation from @mountiny.

cc @zanyrenney

@mountiny mountiny changed the title [$250] Improve ReportScreen rendering time [HOLD for Payment 2024-07-22] [$250] Improve ReportScreen rendering time Jul 20, 2024
@mountiny mountiny added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Jul 20, 2024
@mountiny
Copy link
Contributor Author

$375 to @ikevin127 for reviewing 2 PRs and deducing 50% of one bounty for the regression

@ikevin127
Copy link
Contributor

@zanyrenney Friendly bump for payments, as I noticed this doensn't have the Daily label which could cause delays.

@zanyrenney
Copy link
Contributor

payment summary

@ikevin127 - paid $375 via upwork
@kosmydel - internal contractor - not paid incrementally.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers 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
Development

No branches or pull requests

4 participants