Skip to content

[Due for payment 2025-09-02] [Due for payment 2025-08-26] [$250] Prevent redundant Sidebar sorting #67894

Closed

Description

@mountiny

Coming from here

Background:

When a report is opened via search, it triggers a navigation state change. This causes useCurrentReportID to update the currentReportID, which flows into useSidebarOrderedReports and leads to a recalculation of reportsToDisplayInLHN.

Problem:

When the sidebar recalculates due to navigation or data updates, even when the current report hasn't changed or the report data is the same, it causes redundant sortReportsToDisplayInLHN calls, which degrades performance in larger accounts.

Solution:

Implement a series of improvements to reduce unnecessary sortReportsToDisplayInLHN calls and improve performance:

  • Add change detection to updateCurrentReportID to exit early when the report ID hasn't changed.
  • Add useDeepCompareRef to avoid triggering re-sorting unless report data meaningfully changes.
  • Replace inefficient forEach loops with for...of in performance-sensitive iteration.
  • Break down complex update logic into smaller, purpose-specific functions for clarity and efficiency.

The above changes improve the performance of sortReportsToDisplayInLHN by 40–55%:

  • Before: 12–15 ms (small accounts), ~60 ms (large accounts), function appears 9–12 times in the trace
  • After: 6 ms (small accounts), 30–40 ms (large accounts), function appears 4–6 times in the trace
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021952688466440387545
  • Upwork Job ID: 1952688466440387545
  • Last Price Increase: 2025-08-05
Issue OwnerCurrent Issue Owner: @hoangzinh
Issue OwnerCurrent Issue Owner: @OlimpiaZurek

Activity

  1. added
    Daily
    Bug
    AutoAssignerNewDotQuality
    on Aug 5, 2025
  2. melvin-bot commented on Aug 5, 2025

    @melvin-bot

    Triggered auto assignment to @JS00001 (AutoAssignerNewDotQuality)

  3. melvin-bot commented on Aug 5, 2025

    @melvin-bot

    Triggered auto assignment to @adelekennedy (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.

  4. added
    External
    on Aug 5, 2025
  5. changed the title [-]Prevent redundant Sidebar sorting[/-] [+][$250] Prevent redundant Sidebar sorting[/+] on Aug 5, 2025
  6. melvin-bot commented on Aug 5, 2025

    @melvin-bot
  7. added
    Help Wanted
    on Aug 5, 2025
  8. melvin-bot commented on Aug 5, 2025

    @melvin-bot

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

  9. 27 remaining items

  10. melvin-bot commented on Aug 26, 2025

    @melvin-bot

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

    For reference, here are some details about the assignees on this issue:

    • @hoangzinh requires payment through NewDot Manual Requests
    • @OlimpiaZurek does not require payment (Contractor)
    • @ikevin127 requires payment through NewDot Manual Requests
  11. melvin-bot commented on Aug 26, 2025

    @melvin-bot

    @hoangzinh / @ikevin127 @adelekennedy The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  12. ikevin127 commented on Aug 26, 2025

    @ikevin127
    Contributor

    Feel free to unassign me from this issue since @hoangzinh took over as C+ reviewer and only they will be getting payments.

  13. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    • Reviewer: @hoangzinh owed $250 via NewDot
    • Contributor: @OlimpiaZurek is from an agency-contributor and not due payment

    BugZero Checklist (@adelekennedy)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1952688466440387545/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  14. adelekennedy commented on Sep 2, 2025

    @adelekennedy
    Contributor

    Payment Summary (Improvement)

    Contributor+: @hoangzinh owed $750 via NewDot

  15. hoangzinh commented on Sep 3, 2025

    @hoangzinh
    Contributor

    @adelekennedy it should be $750, according to the thread here

  16. mallenexpensify commented on Sep 15, 2025

    @mallenexpensify
    Contributor

    @hoangzinh updated to $750 for ya.

    Closing, reopen if test cases are needed.

  17. moved this from AWAITING DEPLOYMENT to Done in [#whatsnext] #qualityon Sep 15, 2025
  18. hoangzinh commented on Sep 16, 2025

    @hoangzinh
    Contributor

    Thanks @mallenexpensify. I requested ND

  19. garrettmknight commented on Sep 16, 2025

    @garrettmknight
    Contributor

    $750 approved for @hoangzinh

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