ReportActionAvatars -> UserAvatar for single avatars migration - #94906
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
…' into chore/user-avatar-for-single-avatar-usages
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@shubham1206agra 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] |
|
cc @roryabraham |
roryabraham
left a comment
There was a problem hiding this comment.
No blockers from me. This PR feels like a nice step in the right direction. If we don't include the new tests, it's a net reduction in code. Great job!
There was a problem hiding this comment.
Just clarifying, I think the intention is that src/Avatar/connected contains the level-two wrappers around the level-one primitives for common use-cases. And they're "connected" because they actually hook up data, rather than just displaying what they're given via props?
There was a problem hiding this comment.
yup, that was my reasoning behind the name. Open to other suggestions if you feel like naming should be highlighting leveled structure more
| size?: ValueOf<typeof CONST.AVATAR_SIZE>; | ||
|
|
||
| /** Whether to show the tooltip on hover */ | ||
| shouldShowTooltip?: boolean; |
There was a problem hiding this comment.
I think it's been an oversight of our efforts so far that shouldShowTooltip has survived our decomposition efforts. Callsites that use tooltips should include them in the JSX themselves. Callsites that don't should not.
NAB for this PR, but I think it's something we should address separately
There was a problem hiding this comment.
Agreed, but I'd rather do it in separate PR -> Draft stacked on this one
There was a problem hiding this comment.
@jmusial Use GH stack PRs system they recently introduced.
There was a problem hiding this comment.
would love to but AFAIK they don't work from forks :(
|
awaiting C+ review |
|
No product review needed. |
|
There will be a second PR for this issue - migrating for multiple accounts passed |
|
@shubham1206agra kind bump |
| * Use whenever exactly one account is rendered. Pass `Avatar/UserAvatar` a `source` instead when the avatar is already resolved. | ||
| */ | ||
| function AccountAvatar({accountID, size = CONST.AVATAR_SIZE.DEFAULT, shouldShowTooltip = true, fallbackDisplayName, containerStyle}: AccountAvatarProps) { | ||
| const personalDetails = usePersonalDetails(); |
There was a problem hiding this comment.
@jmusial Do we need to subscribe to entire personal details object for a single one? Maybe use personalDetailsSelector selector for this. Since personal details object is not super deep, I would say this would optimize the component.
There was a problem hiding this comment.
@shubham1206agra usePersonalDetails uses context underneath so I think this should be cheaper that creating new useOnyx subscription for every avatar
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-08-07.at.8.42.23.PM.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.52-0 🚀
|
|
🤖 I reviewed this PR against Expensify's help site content under Why: This is an internal component refactor. It adds No draft PR was created since there's nothing to update. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.52-11 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
This PR adds
Avatar/connected/AccountAvatar- a single-accountIDavatar that resolves its icon from the personal-details context through a sharedbuildUserIconhelper, with none ofReportActionAvatars'Onyx subscriptions, report/action/policy lookups, or layout resolution - and migrates the eight call sites that were using ReportActionAvatars to render exactly one known user.No visual change is intended.
Fixed Issues
$ #94586
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.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
Screen.Recording.2026-08-05.at.12.28.21.mov
Android: mWeb Chrome
Screen.Recording.2026-08-05.at.12.24.14.mov
iOS: Native
Screen.Recording.2026-08-05.at.12.44.42.mov
iOS: mWeb Safari
Screen.Recording.2026-08-05.at.12.31.45.mov
MacOS: Chrome / Safari
Screen.Recording.2026-08-05.at.12.11.07.mov