perf: optimize useSidebarOrderedReports hook#68038
Conversation
5a0d1af to
4c02fa0
Compare
|
@ikevin127 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-08-20.at.20.18.10.android.movAndroid: mWeb ChromeScreen.Recording.2025-08-20.at.20.20.48.android.chrome.moviOS: HybridAppScreen.Recording.2025-08-20.at.20.27.25.ios.moviOS: mWeb SafariScreen.Recording.2025-08-20.at.20.29.36.movMacOS: Chrome / SafariScreen.Recording.2025-08-14.at.21.59.53.web.movMacOS: DesktopScreen.Recording.2025-08-14.at.22.02.29.desktop.mov |
27d8b30 to
3b6df46
Compare
|
Hi @OlimpiaZurek code changes LGTM. Reg. tests, can you take a look again? When I reverted all changes, only 1 test is failed. I expect it should fail with:
|
|
@OlimpiaZurek, there's a bit of delay in updating the order in LHN for me on small-screen devices Step to reproduce:
Screen.Recording.2025-08-14.at.22.15.34.mov |
The delay was caused by using I also adjusted the unit tests. Since |
|
Thanks @OlimpiaZurek. By using |
Based on measurements from Chrome performance profiling: on the main branch, |
|
Perfect. Thank you @OlimpiaZurek |
|
I will try to complete review checklist today |
|
@OlimpiaZurek Similar issue here, when I reverted changes, the tests are still passed. |
|
The tests pass either way because what changed is the argument we pass to |
|
If tests can't catch someone reverting your changes, they're not reliable @OlimpiaZurek. |
|
This change only affects performance, not functionality. So if it gets reverted, the user behavior stays the same. I’m not sure this is something unit tests could reliably catch |
|
@JS00001 It looks like it's hard to write unit tests to cover changes in this PR. Do you think we can skip unit tests for this PR? |
|
Yeah I agree, we need to test functionality, and it looks like the tests are doing that. Testing for perf is a bit different. I think we're fine with keeping it as is, since the functionality itself is covered |
|
@JS00001 do you mean we can keep the current unit tests in this PR? |
3de2012 to
169e354
Compare
|
Yeah we can keep them, I think adding functionality tests is never a downside |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.1.98-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.1.98-12 🚀
|

Explanation of Change
This PR optimizes
useSidebarOrderedReportsby usinguseDeepCompareRefto prevent unnecessary re-renders and adds test coverage.Fixed Issues
$ #67894
PROPOSAL:
Before:

After:

Tests
* Pinned/GBR chats at the top
* Chats with errors next
* Draft chats (unsent messages)
* Regular chats
* Archived chats at the bottom
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android_native_2.webm
Android: mWeb Chrome
android_mweb_2.webm
iOS: Native
iOS_native_2.mp4
iOS: mWeb Safari
iOS_mweb_2.mp4
MacOS: Chrome / Safari
web_2.mov
MacOS: Desktop
desktop_2.mov