[No QA] refactor: replace deprecated getReportName with getReportNameFromDerived in sidebar sorting#86193
Conversation
…ved in sidebar sorting
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@MelvinBot please measure actual performance (this branch vs main) with high-traffic test data |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d5db0e055
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| const getOrderedReportIDs = useCallback( | ||
| () => SidebarUtils.sortReportsToDisplayInLHN(reportsToDisplayInLHN, priorityMode, localeCompare, hasDraftByReportID, reportNameValuePairs, conciergeReportID), | ||
| () => SidebarUtils.sortReportsToDisplayInLHN(reportsToDisplayInLHN, priorityMode, localeCompare, hasDraftByReportID, reportNameValuePairs, reportAttributes), |
There was a problem hiding this comment.
Keep concierge ID as a sort invalidation signal
This change removes the CONCIERGE_REPORT_ID subscription from sidebar ordering and replaces it with reportAttributes, but REPORT_ATTRIBUTES derivation does not list ONYXKEYS.CONCIERGE_REPORT_ID as a dependency (src/libs/actions/OnyxDerived/configs/reportAttributes.ts dependencies block). If concierge ID is loaded after initial report hydration, report attributes are not recomputed, so this sorter keeps using stale/empty concierge display names (especially when report.reportName is empty) and the LHN order/text can stay incorrect until some unrelated report update happens. Before this commit, concierge ID changes directly invalidated sorting.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch. Added ONYXKEYS.CONCIERGE_REPORT_ID to reportAttributes dependencies and it now triggers a full recompute when the value changes.
|
@dmkt9 would you mind reviewing this one? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.hybrid.mp4iOS: HybridAppios.hybrid.mp4MacOS: Chrome / Safarimac.safari.mp4 |
|
🚧 @JS00001 has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.3.49-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.3.49-2 🚀
|


Explanation of Change
The deprecated
getReportNamefunction was used in two places in sidebar sorting and welcome message generation:categorizeReportsForLHNandgetRoomWelcomeMessage. This function requires aconciergeReportIDparameter and has been marked deprecated in favor ofgetReportNameFromDerived, which reads from the pre-computedreportAttributesderived value.This change replaces both call sites with
getReportNameFromDerived, passesreportAttributesfromuseReportAttributes()through the call chain, and removes the now-unnecessaryconciergeReportIDOnyx subscription fromuseSidebarOrderedReports. TheDebugReportActionscomponent also gets the same update to stay consistent.The internal helper functions
categorizeReportsForLHN,sortCategorizedReports, andcombineReportCategoriesare no longer exported on the default object — they are now exported as named underscore-prefixed exports for unit testing only, which makes the public API ofSidebarUtilscleaner.Reassure benchmark on 15k reports shows an 11.1% improvement on
getReportsToDisplayInLHN(default mode: 68.9ms to 61.2ms) with no regressions.Fixed Issues
$ #86312
PROPOSAL:
Tests
Offline tests
N/A - This is a pure refactor with no changes to offline behavior. The derived value fallback (
report.reportName) ensures names display even when derived data is not yet populated.QA Steps
No QA needed. This is a pure internal refactor that replaces a deprecated function call with its recommended replacement. No user-facing behavior changes. All existing unit tests pass with updated signatures.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari