Remove deprecated report name functions in ReportUtils (Part 2)#82078
Remove deprecated report name functions in ReportUtils (Part 2)#82078mohammadjafarinejad wants to merge 4 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@eVoloshchak 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] |
1 similar comment
|
@eVoloshchak 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] |
| /** | ||
| * @private | ||
| * Extracts all reports from the search data. | ||
| */ |
There was a problem hiding this comment.
❌ PERF-13 (docs)
Each of these helper functions calls Object.keys(data) which is iterator-independent. While the pattern is cleaner than the previous approach, these functions are called together in getReportActionsSections() which means Object.keys(data) is invoked 5 times for the same data object.
Suggested fix: Extract Object.keys(data) once in the calling function and pass the keys array to these helpers:
function getReportActionsSections(data: OnyxTypes.SearchResults["data"]): [ReportActionListItemType[], number] {
const dataKeys = Object.keys(data);
const transactionsFromData = getTransactionsFromData(data, dataKeys);
const reportsFromData = getReportsFromData(data, dataKeys);
const policiesFromData = getPoliciesFromData(data, dataKeys);
const reportNameValuePairsFromData = getReportNameValuePairsFromData(data, dataKeys);
const reportActionsFromData = getReportActionsFromData(data, dataKeys);
// ...
}
function getReportsFromData(data: OnyxTypes.SearchResults["data"], keys: string[]): OnyxCollection<OnyxTypes.Report> {
const reports: Record<string, OnyxTypes.Report> = {};
for (const key of keys) {
if (isReportEntry(key)) {
reports[key] = data[key];
}
}
return reports;
}
// Similar changes for other helper functionsPlease rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f111b1861
ℹ️ 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".
| reportNameValuePairsFromData, | ||
| data.personalDetailsList, | ||
| reportActionsFromData, | ||
| undefined, |
There was a problem hiding this comment.
Pass current user ID into computeReportName
This call hard-codes undefined for computeReportName’s currentUserAccountID, which changes chat-search naming for reports whose title is participant-derived (for example 1:1 chats/invoice rooms): the current user can be included in the generated name or payer labels can be computed from the wrong perspective. Before this refactor, getSearchReportName delegated to getReportName, which used the subscribed session account ID implicitly, so this is a regression specific to the new call path in Reports > Chats.
Useful? React with 👍 / 👎.
Explanation of Change
Remove deprecated
getSearchReportNameFixed Issues
$ #76852
PROPOSAL:
Tests
Note: Also test with expense reports, chat threads, invoices, and group chats in search to ensure report names display correctly across all report types.
Offline tests
Same as test.
QA Steps
Same as test.
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))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.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.mp4
Android: mWeb Chrome
android-web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
web.mp4