-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
AutoAssignerNewDotQualityUsed to assign quality issues to engineersUsed to assign quality issues to engineersAwaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorWeeklyKSv2KSv2
Description
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 Owner
Current Issue Owner: @hoangzinhIssue Owner
Current Issue Owner: @OlimpiaZurekReactions are currently unavailable
Metadata
Metadata
Labels
AutoAssignerNewDotQualityUsed to assign quality issues to engineersUsed to assign quality issues to engineersAwaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorWeeklyKSv2KSv2
Type
Projects
Status
Done