[Phase 2 of #66427, sub-pr 2/5] Migrate deprecatedGetReportName → getReportName in component files - #96952
Conversation
…nsify#66427) Replace deprecatedGetReportName(report, reportAttributes) with getReportName(report, derivedReportName) across AvatarWithDisplayName, ReportField, MoneyRequestView, ReportWelcomeText, useFilterReportValue, SidebarUtils and DebugReportActions. Names are now sourced via the new getDerivedReportNameByReportID helper (ReportAttributesUtils) and the new useDerivedReportNamesByReportIDs hook, which subscribes to REPORT_ATTRIBUTES once and selects only the needed names instead of subscribing to the whole attributes Record for a single name. Part of Expensify#66427 Phase 2.
Add unit tests for getDerivedReportNameByReportID (ReportAttributesUtils) and useDerivedReportNamesByReportIDs (useReportAttributes), and adapt SidebarUtilsTest to the derivedReportName argument of getWelcomeMessage.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
…ames (Expensify#66427) The old name was nearly identical to the useDerivedReportNameByReportID hook but did something different (a pure lookup on a passed-in names map, not an Onyx fetch). getReportNameFromNames makes clear it selects from the map returned by useDerivedReportNamesByReportIDs.
|
@DylanDylann 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] |
|
@marcochavezf 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] |
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
| return { | ||
| reportID: match.reportID, | ||
| name: deprecatedGetReportName(match, reportAttributes) || match.reportName, | ||
| name: getReportName(match, reportAttributes?.[match.reportID]?.reportName) || match.reportName, |
|
|
||
| return reportIDs | ||
| .map((id) => deprecatedGetReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${id}`], reportAttributes?.reports)) | ||
| .map((id) => getReportName(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${id}`], reportAttributes?.reports?.[id]?.reportName)) |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-07-29.at.15.09.03.mov |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
eef4949 to
49e1ac0
Compare
Replace the whole-Record useReportAttributes() subscription with a single useDerivedReportNamesByReportIDs call for the trip room and parent report names, so the component only re-renders when those specific names change.
49e1ac0 to
4853736
Compare
Replace the whole REPORT_ATTRIBUTES subscription with a single useDerivedReportNamesByReportIDs call so the hook only re-renders when one of the requested report names changes.
|
@DylanDylann PR is ready for next review round |
| reportID: match.reportID, | ||
| name: deprecatedGetReportName(match, reportAttributes) || match.reportName, | ||
| }; | ||
| return match; |
There was a problem hiding this comment.
Let's return report.reportName only instead of the entire report
There was a problem hiding this comment.
I see getReportName receives a report object. But a selector returning a single field would be better for performance. So please find a way to resolve the type problem.
There was a problem hiding this comment.
Should allow getReportName accept an object or a string?
There was a problem hiding this comment.
Should allow getReportName accept an object or a string?
I think about this option too, but then it's hard to deal with this logic. And, somehow, we increase the refactoring scope.
App/src/libs/ReportNameUtils.ts
Lines 1140 to 1142 in e4ebd3a
There was a problem hiding this comment.
@hoangzinh Let's keep following up on this problem in the next PRs. If making this refactor also helps performance in other places, I'd still suggest doing it.
|
@hoangzinh Could you please resolve the conflict and ping me again to approve? Thank you |
|
@marcochavezf all yours |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 marcochavezf 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/marcochavezf in version: 9.4.49-0 🚀
|
|
🤖 Help site review — no changes required I reviewed the changes in this PR against the help site content in Conclusion: No help site changes are needed, so I did not create a draft PR. WhyThis is a behavior-preserving internal refactor — it migrates
Report names (chat headers, the expense "Report" field, welcome messages, sidebar) render identically to before — no new feature, no UI label change, no pricing/billing/workspace/integration behavior change. Help articles describe user-facing product behavior, none of which is altered here. |
Explanation of Change
Part of #66427. Phase 2, Sub-PR 2 of 5 Sub-PR 2 — migrate deprecatedGetReportName → getReportName per directory src/components/**
Next step:
Fixed Issues
$ #66427
PROPOSAL: #66427 (comment)
Tests
Same as QA
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
1. Report header title — AvatarWithDisplayName
2. Expense confirmation "Report" field — ReportField
3. Welcome message - ReportWelcomeText / SidebarUtils.getRoomWelcomeMessage
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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
Screen.Recording.2026-07-24.at.20.13.31.mp4