Repository navigation
[No QA] perf: use derived value for LHN report name computation #84557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4df78b3
85f4d28
22a8f82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,7 @@ import { | |
| isTagModificationAction, | ||
| isTaskAction, | ||
| } from './ReportActionsUtils'; | ||
| import {getReportName as getReportNameFromDerived} from './ReportNameUtils'; | ||
| import type {OptionData} from './ReportUtils'; | ||
| import { | ||
| canUserPerformWriteAction as canUserPerformWriteActionUtil, | ||
|
|
@@ -916,8 +917,7 @@ function getOptionData({ | |
| : translate('workspace.invite.removed'); | ||
| const users = translate(targetAccountIDsLength > 1 ? 'common.members' : 'common.member')?.toLocaleLowerCase(); | ||
| result.alternateText = formatReportLastMessageText(`${actorDisplayName ?? lastActorDisplayName}: ${verb} ${targetAccountIDsLength} ${users}`); | ||
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
| const roomName = getReportName({report: lastActionReport}) || lastActionOriginalMessage?.roomName; | ||
| const roomName = getReportNameFromDerived(lastActionReport ?? undefined, reportAttributesDerived) || lastActionOriginalMessage?.roomName; | ||
| if (roomName) { | ||
| const preposition = | ||
| lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM || lastAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM | ||
|
|
@@ -1163,8 +1163,7 @@ function getOptionData({ | |
| result.phoneNumber = personalDetail?.phoneNumber ?? ''; | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
| const reportName = getReportName({report, policy, invoiceReceiverPolicy, isReportArchived, conciergeReportID}); | ||
| const reportName = getReportNameFromDerived(report, reportAttributesDerived); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this PR changes the code path for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This call now relies entirely on Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
|
|
||
| result.text = reportName; | ||
| result.subtitle = subtitle; | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes
getOptionData()depend entirely onreportAttributesDerivedfor display names and otherwise falls back to rawreport.reportName, which is often empty for optimistic chats (for examplebuildOptimisticSelfDMReportsetsreportName: ''insrc/libs/ReportUtils.ts). In states whereONYXKEYS.DERIVED.REPORT_ATTRIBUTESis not populated yet (initial hydration, optimistic updates), LHN entries can now render blank titles; the previousReportUtils.getReportName(...)call computed participant/policy-based names and avoided that regression.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback is already handled.
getReportNameinReportNameUtils.ts(line 943) returnsreportAttributesDerivedValue?.[report.reportID]?.reportName ?? report.reportName ?? '', so when derived data isn't populated yet it falls back toreport.reportName.