Skip to content
Draft
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
12 changes: 6 additions & 6 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1058 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1063,7 +1063,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1066 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1081,7 +1081,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1084 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (deprecatedCurrentUserAccountID) {
Expand All @@ -1093,7 +1093,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1096 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1101,7 +1101,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1104 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1111,7 +1111,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1114 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1119,7 +1119,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1122 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1155,14 +1155,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1158 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

let deprecatedAllTransactions: OnyxCollection<Transaction> = {};
let deprecatedReportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1165 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1188,7 +1188,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1191 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -3311,7 +3311,7 @@
const avatars: Icon[] = [];

for (const accountID of participantsList) {
const avatarSource = personalDetails?.[accountID]?.avatar ?? FallbackAvatar;
const avatarSource = personalDetails?.[accountID]?.avatar ?? getDefaultAvatarURL({accountID});
const displayNameLogin = personalDetails?.[accountID]?.displayName ? personalDetails?.[accountID]?.displayName : personalDetails?.[accountID]?.login;
const userIcon = {
id: accountID,
Expand Down Expand Up @@ -3593,7 +3593,7 @@

return {
id: accountID,
source: details?.avatar ?? FallbackAvatar,
source: details?.avatar ?? getDefaultAvatarURL({accountID}),
type: CONST.ICON_TYPE_AVATAR,
name: displayName,
fallbackIcon: details?.fallbackIcon,
Expand Down Expand Up @@ -3651,7 +3651,7 @@
const workspaceIcon = getWorkspaceIcon(report, policy);
const actorDetails = parentReportAction?.actorAccountID ? personalDetails?.[parentReportAction.actorAccountID] : undefined;
const memberIcon = {
source: actorDetails?.avatar ?? FallbackAvatar,
source: actorDetails?.avatar ?? getDefaultAvatarURL({accountID: parentReportAction?.actorAccountID}),
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 Guard default-avatar lookup when accountID is missing

In getIconsForExpenseRequest, parentReportAction can be unavailable while report actions are still loading, so parentReportAction?.actorAccountID is undefined here. Passing that into getDefaultAvatarURL no longer preserves the old neutral fallback; it resolves to the deterministic default for accountID 0 (avatar 1), which shows a specific user-style avatar for an unknown actor and can cause misleading/flickering identity in the header. Please keep FallbackAvatar (or explicitly branch on a defined accountID) for this no-accountID state; the same pattern was introduced in the new chat-thread/IOU replacements.

Useful? React with 👍 / 👎.

id: parentReportAction?.actorAccountID,
type: CONST.ICON_TYPE_AVATAR,
name: actorDetails?.displayName ?? '',
Expand All @@ -3678,7 +3678,7 @@
const actorDisplayName = getDisplayNameOrDefault(actorDetails, '', false);
const actorIcon = {
id: actorAccountID,
source: actorDetails?.avatar ?? FallbackAvatar,
source: actorDetails?.avatar ?? getDefaultAvatarURL({accountID: actorAccountID}),
name: formatPhoneNumber(actorDisplayName),
type: CONST.ICON_TYPE_AVATAR,
fallbackIcon: actorDetails?.fallbackIcon,
Expand Down Expand Up @@ -3772,15 +3772,15 @@
const managerDetails = report?.managerID ? personalDetails?.[report.managerID] : undefined;
const ownerDetails = report?.ownerAccountID ? personalDetails?.[report.ownerAccountID] : undefined;
const managerIcon = {
source: managerDetails?.avatar ?? FallbackAvatar,
source: managerDetails?.avatar ?? getDefaultAvatarURL({accountID: report?.managerID}),
id: report?.managerID,
type: CONST.ICON_TYPE_AVATAR,
name: managerDetails?.displayName ?? '',
fallbackIcon: managerDetails?.fallbackIcon,
};
const ownerIcon = {
id: report?.ownerAccountID,
source: ownerDetails?.avatar ?? FallbackAvatar,
source: ownerDetails?.avatar ?? getDefaultAvatarURL({accountID: report?.ownerAccountID}),
type: CONST.ICON_TYPE_AVATAR,
name: ownerDetails?.displayName ?? '',
fallbackIcon: ownerDetails?.fallbackIcon,
Expand Down
Loading