Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
original issue not reproducible event without report.policyAvatar
  • Loading branch information
wildan-m committed Oct 15, 2024
1 parent bb40fd8 commit 964c35a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1997,14 +1997,14 @@ function getWorkspaceIcon(report: OnyxInputOrEntry<Report>, policy?: OnyxInputOr
const iconFromCache = workSpaceIconsCache.get(cacheKey);
// disabling to protect against empty strings
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const policyAvatarURL = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatarURL || report?.policyAvatar;
const policyAvatarURL = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatarURL;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const policyExpenseChatAvatarSource = policyAvatarURL || getDefaultWorkspaceAvatar(workspaceName);

const isSameAvatarURL = iconFromCache?.icon?.source === policyExpenseChatAvatarSource;
const hasWorkSpaceNameChanged = iconFromCache?.name !== workspaceName;

if (iconFromCache && (isSameAvatarURL || report?.policyAvatar === undefined) && !hasWorkSpaceNameChanged) {
if (iconFromCache && isSameAvatarURL && !hasWorkSpaceNameChanged) {
return iconFromCache.icon;
}

Expand Down
1 change: 0 additions & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,6 @@ export default memo(ReportActionItem, (prevProps, nextProps) => {
prevProps.shouldHideThreadDividerLine === nextProps.shouldHideThreadDividerLine &&
prevProps.report?.total === nextProps.report?.total &&
prevProps.report?.nonReimbursableTotal === nextProps.report?.nonReimbursableTotal &&
prevProps.report?.policyAvatar === nextProps.report?.policyAvatar &&
prevProps.linkedReportActionID === nextProps.linkedReportActionID &&
lodashIsEqual(prevProps.report?.fieldList, nextProps.report?.fieldList) &&
lodashIsEqual(prevProps.transactionThreadReport, nextProps.transactionThreadReport) &&
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ type Report = OnyxCommon.OnyxValueWithOfflineFeedback<
/** The time of the last mention of the report */
lastMentionedTime?: string | null;

/** The policy avatar to use, if any */
policyAvatar?: string | null;

/** The policy name to use */
policyName?: string | null;

Expand Down

0 comments on commit 964c35a

Please sign in to comment.