Skip to content

[HOLD for Payment 2024-07-22] [$250] Improve ReportScreen rendering time #44925

Closed

Description

@mountiny

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

Activity

  1. added
    Daily
    Bug
    AutoAssignerNewDotQuality
    on Jul 5, 2024
  2. self-assigned this
    on Jul 5, 2024
  3. melvin-bot commented on Jul 5, 2024

    @melvin-bot

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

  4. melvin-bot commented on Jul 5, 2024

    @melvin-bot

    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.

  5. added
    External
    on Jul 5, 2024
  6. melvin-bot commented on Jul 5, 2024

    @melvin-bot
  7. changed the title [-]Improve ReportScreen rendering time[/-] [+][$250] Improve ReportScreen rendering time[/+] on Jul 5, 2024
  8. added
    Help Wanted
    on Jul 5, 2024
  9. melvin-bot commented on Jul 5, 2024

    @melvin-bot

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

  10. removed
    Help Wanted
    on Jul 5, 2024
  11. 7 remaining items

  12. added
    Weekly
    and removed
    Weekly
    on Jul 8, 2024
  13. melvin-bot commented on Jul 10, 2024

    @melvin-bot

    ⚠️ 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.

  14. ikevin127 commented on Jul 15, 2024

    @ikevin127
    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

  15. changed the title [-][$250] Improve ReportScreen rendering time[/-] [+][HOLD for Payment 2024-07-22] [$250] Improve ReportScreen rendering time[/+] on Jul 20, 2024
  16. added
    Awaiting Payment
    and removed
    Reviewing
    on Jul 20, 2024
  17. mountiny commented on Jul 20, 2024

    @mountiny
    ContributorAuthor

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

  18. ikevin127 commented on Jul 22, 2024

    @ikevin127
    Contributor

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

  19. zanyrenney commented on Jul 23, 2024

    @zanyrenney
    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

Metadata

Metadata

Labels

AutoAssignerNewDotQualityAwaiting PaymentBugExternalWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions