Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ import {
isTagModificationAction,
isTaskAction,
} from './ReportActionsUtils';
import {getReportName as getReportNameFromDerived} from './ReportNameUtils';
import type {OptionData} from './ReportUtils';
import {
canUserPerformWriteAction as canUserPerformWriteActionUtil,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve non-derived fallback for LHN report titles

This change makes getOptionData() depend entirely on reportAttributesDerived for display names and otherwise falls back to raw report.reportName, which is often empty for optimistic chats (for example buildOptimisticSelfDMReport sets reportName: '' in src/libs/ReportUtils.ts). In states where ONYXKEYS.DERIVED.REPORT_ATTRIBUTES is not populated yet (initial hydration, optimistic updates), LHN entries can now render blank titles; the previous ReportUtils.getReportName(...) call computed participant/policy-based names and avoided that regression.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts?

Copy link
Copy Markdown
Contributor Author

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. getReportName in ReportNameUtils.ts (line 943) returns reportAttributesDerivedValue?.[report.reportID]?.reportName ?? report.reportName ?? '', so when derived data isn't populated yet it falls back to report.reportName.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's difference but I think staging is buggy and we're fixing this.

this branch: invited @safsdf@dsfsd.co

Image

staging: invited safsdf@dsfsd.co

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this PR changes the code path for roomName (line 920). The old getReportName from ReportUtils would fall back to full name computation when derived data wasn't ready, while the new getReportNameFromDerived falls back to report.reportName. In normal flow (derived populated) both return the same value. The @ prefix difference comes from what's stored in derived vs what the legacy computation produced.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fall back when derived report name is unavailable

This call now relies entirely on reportAttributesDerived, but that value is optional and can be temporarily missing/partial during hydration or right after report updates. In those windows getReportNameFromDerived() falls back to report.reportName, which is often empty for DM/group chats, so the LHN row text can render blank until a later derived recompute. The previous ReportUtils.getReportName(...) path computed a display name immediately from report participants/policy data, so this is a user-visible regression in sidebar labeling.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


result.text = reportName;
result.subtitle = subtitle;
Expand Down
Loading