You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-08-07] [$250] Workspace - Workspace avatar changes to user avatar after changing user avatar #95854
⚠️Medium confidence — the mechanism is unambiguous in code, but whether this is a bug or working‑as‑designed is a product call (see the note at the end).
Root Cause
The workspace chat (policy expense chat) avatar is a two‑part avatar: a primary workspace icon plus an owner/member subscript. The primary workspace image is not affected by a user avatar change — for a freshly created workspace avatarURL is empty, so the primary is the deterministic name‑derived default building SVG. What actually changes is the subscript, which is the owner's personal avatar. Since the reporter created the workspace, they are the owner, so the subscript is their avatar — and it updates the moment they upload a new profile photo.
So there is no state leak — personal and workspace avatars are separate. The perceived "workspace avatar changed" is the owner subscript re‑rendering with the new photo.
Chat renders via getIcons → getIconsForPolicyExpenseChat → [default building icon, owner subscript = current user].
User uploads profile photo → updateAvatar merges into PERSONAL_DETAILS_LIST[accountID].avatar only (no policy write).
Onyx change re‑renders the chat → the subscript re‑reads personalDetails[ownerAccountID].avatar → shows the new photo.
Alternatives considered: a backend leak writing the user avatar into the policy's avatarURL was ruled out on the client side — updateAvatar never touches any COLLECTION.POLICY key, and the workspace‑icon read path never reads personal details. The change is entirely explained by the client‑side subscript logic above.
Proposed Change (if this is deemed a bug)
If the intent is that a workspace chat's avatar must not track the owner's personal photo, the change belongs at the subscript resolution in getIconsForPolicyExpenseChat (ReportUtils.ts:3858) — e.g. stop using the owner's live personal avatar as the workspace‑chat subscript. This needs a product decision first, because showing the member as the subscript on a policy expense chat is the current intended design.
⚠️ Product question for the team: For the workspace chat, should the subscript continue to show the owner's (live) personal avatar? If yes, this is working‑as‑designed and the report should be closed as WAI. If no, the fix is scoped to the single subscript line above.
Related (not a duplicate):Expensify/App#93083 (Avatars: Default to Letters, recently closed) touched default‑avatar rendering.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/95854) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 17:40:08 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace is created without uploading a workspace avatar, changing the user's own account avatar (Account > Profile > Upload photo) makes the workspace's avatar in the workspace chat change to the new personal photo. The expected behavior is that the workspace keeps its stable default avatar and does not track the user's personal avatar.
What is the root cause of that problem?
PR #93926 moved avatar cropping from a per-component modal to a shared crop screen that communicates through two global Onyx singletons, AVATAR_CROP_DRAFT and AVATAR_CROP_RESULT (src/ONYXKEYS.ts L103/L106), paired with a random token. When a picker opens the cropper, useAvatarCrop stores the token in its own tokenRef and persists a draft whose openerKey is the globally focused route:
The hook also has a re-adoption effect meant to recover a draft orphaned by a page refresh (L63-L83). That effect runs in every mounted instance of the hook whenever the draft changes, and its only ownership test compares two global values: the currently focused path (minus the crop suffix) against draft.openerKey (L76-L80). Nothing in the check identifies which picker actually opened the crop, so every mounted instance with an empty tokenRef adopts the token.
The repro wires this up exactly. Creating a workspace lands on the workspace split navigator whose default central screen is WorkspaceOverviewPage (WorkspaceSplitNavigator.tsx L57), which mounts its own AvatarWithImagePicker and therefore its own useAvatarCrop instance (WorkspaceOverviewPage.tsx L525, AvatarWithImagePicker.tsx L120). Navigating to Account > Profile pushes the settings navigator on top, but the workspace screen is not frozen: freezeNonTopScreens is only enabled inside split navigators (createSplitNavigator/index.tsx L48), the Overview page remains the top central screen of its own split, and the root stack applies no freezing at all. The background workspace picker keeps reacting to Onyx. When the profile avatar form opens the cropper (useProfileAvatarForm.ts L51), the workspace instance's adoption effect sees the new draft, the focused-route comparison passes (it is a global fact, identical for every instance), and it silently adopts the profile crop's token.
On crop save, AvatarCropPage writes the result under that token (AvatarCropPage.tsx L53-L56) and the consume effect (useAvatarCrop.ts L85-L94) fires in both instances. The profile form merely stages the image for a later Save, but the workspace picker's onCropped immediately calls updateWorkspaceAvatar(policyID, policy.avatarURL, file) (WorkspaceOverviewPage.tsx L544-L548), which optimistically sets policy.avatarURL and sends UpdateWorkspaceAvatar to the server (Policy.ts L1779-L1822). The user's cropped profile photo is genuinely persisted as the workspace avatar. That is why the change survives refresh and shows in the workspace chat, where getWorkspaceIcon (ReportUtils.ts L3445-L3452) is faithfully rendering the now-corrupted policy.avatarURL.
Timing confirms the regression: the #93926 merge is an ancestor of the 9.4.29-1 version bump and therefore present in the reported 9.4.33-0, and the issue was filed as an exploratory regression two days after that PR shipped.
What changes do you think we should make in order to solve the problem?
Give each crop a stable identity for what avatar is being edited, and only let the instance editing that same target adopt the draft:
useAvatarCrop accepts a targetKey: string param; openCropper writes it into the draft (extend SetAvatarCropDraftParams in src/libs/actions/AvatarCrop.ts and AvatarCropDraft in src/types/onyx/AvatarCropDraft.ts).
In the re-adoption effect, require the identity match before the existing route check:
if(draft.targetKey!==targetKey){return;}
Wiring is nearly free: AvatarWithImagePicker already receives type and avatarID props and can derive targetKey as `${type}-${String(avatarID)}` (e.g. workspace-<policyID> from WorkspaceOverviewPage.tsx L533); the profile form passes a profile key (e.g. avatar-<accountID>). If a caller provides no key, fall back to today's route-only check so unkeyed callers degrade to current behavior rather than breaking.
This shape is immune to the Onyx hydration race: the guard compares the draft against a stable value derived from props, so it does not matter when useOnyx delivers the draft. It also survives refresh by construction, because the key is recomputed from policyID/accountID on remount, so the true opener re-adopts exactly as the effect intends while background pickers (different targets) can never adopt. The existing openerKey focused-route check stays as a secondary guard. Two co-mounted instances with the same targetKey would both deliver, but same target means the same semantic update, so that is harmless.
Tests: (a) two hooks with different target keys, draft written for A, only A's onCropped fires when the result lands; (b) refresh simulation, a fresh mount with a pre-existing draft whose targetKey matches re-adopts after isNavigationReady(); (c) flow regression, with a background workspace Overview mounted, a profile crop must not call updateWorkspaceAvatar and policy.avatarURL stays empty.
What alternative solutions did you explore? (Optional)
Snapshotting the live token at mount (via a hydration-safe read like useInitialOnyxValue) closes the refresh race but still lets a picker that first hydrates while a crop is live snapshot-and-adopt the live token. Capturing "my own route" at mount does not survive refresh, because during state reconstruction Navigation.getActiveRoute() returns the crop route for every remounting screen, so background pickers would capture the opener's route and still collide. A module-scoped "live token" flag also fixes the repro but adds shared mutable state that is awkward to reset and test. The target-key identity avoids all three holes.
An earlier revision of this proposal read the symptom as a display-layer fallback in getWorkspaceIcon with backend-seeded avatarURL. The regression timing and the write path above rule that out: the avatar change is a real client-initiated UpdateWorkspaceAvatar persisted server-side, so any render-side guard would only mask corrupted data (and would break owners who deliberately use the same photo for profile and workspace).
🚨 Edited by proposal-police: This proposal was edited at 2026-07-13 22:27:19 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Right after creating a workspace, if you go to Account > Profile and change your personal avatar, the workspace's avatar changes to that same photo. The workspace should keep its own avatar and ignore edits to your personal one.
What is the root cause of that problem?
This is a real persisted write, not a render artifact. When you save the profile crop, a background updateWorkspaceAvatar API call actually fires and writes policy.avatarURL to your personal photo.
The collision lives in the re-adoption effect in src/hooks/useAvatarCrop.ts:63-83. That effect is instance-blind. Its only ownership test (lines 76-78) compares the global focused route Navigation.getActiveRoute() (with the /avatar-crop suffix stripped) against draft.openerKey. Both are the same global string for every mounted instance of the hook — nothing identifies which picker actually opened the crop. Its deps are [draft?.token, draft?.openerKey], so it runs the moment the profile picker writes AVATAR_CROP_DRAFT, in the normal flow, not just on refresh.
Trace it against the exact repro steps:
Repro step 2 ("Create a workspace") lands you on WorkspaceOverviewPage, which mounts its own useAvatarCrop with tokenRef = null (src/pages/workspace/WorkspaceOverviewPage.tsx:540-545 wires its picker's onImageSelected to updateWorkspaceAvatar(policyID, policy.avatarURL, file)).
You open Account > Profile and crop a new photo. The profile picker writes AVATAR_CROP_DRAFT{token, openerKey: <profile route>} and navigates to <profile route>/avatar-crop.
The still-mounted workspace instance's effect runs: its tokenRef is null, the focused path minus suffix is <profile route>, which equals draft.openerKey — so it adopts the profile token as its own.
On save, AVATAR_CROP_RESULT carries that token, which now matches tokenRef in both the profile instance and the workspace instance (useAvatarCrop.ts:85-94). Both onCropped callbacks fire. AvatarWithImagePicker.tsx:120 wires onCropped: onImageSelected, so the workspace instance calls updateWorkspaceAvatar with your personal photo.
This also explains why "Create a workspace" is a required repro step: you have to be sitting on a page with a live, mounted workspace picker for the two instances to collide.
What changes do you think we should make in order to solve the problem?
Gate re-adoption to the instance that actually owns the draft. The check at useAvatarCrop.ts:76-78 needs an instance-specific identity instead of the shared global route.
There is a hazard here that decides whether the fix is correct, and it rules out the obvious implementation. The effect exists to recover an orphaned crop after a cold refresh, so the guard cannot simply snapshot the draft at mount: useOnyx hydrates asynchronously, so on a cold web refresh draft is undefined on the first render. A naive useRef(draft?.token) captures null, and then rejects the very orphaned token it was meant to re-adopt — silently breaking refresh recovery while appearing to fix the reported bug.
So the guard has to be hydration-aware. Use the existing useInitialOnyxValue helper to snapshot the draft at Onyx loaded rather than at first render, and compare re-adoption against that instance-local snapshot. Cold-refresh recovery keeps working, and the workspace instance no longer matches the profile token, so the stray updateWorkspaceAvatar never fires.
Add a test that mounts two AvatarWithImagePicker instances (workspace + profile), triggers a profile crop, and asserts updateWorkspaceAvatar is not called — that is the exact path that shipped broken. A second test should cold-mount with Onyx unhydrated and assert the orphaned draft is still re-adopted, which is the case a first-render ref snapshot regresses.
What alternative solutions did you explore? (Optional)
Render-side fixes do not work here, because the personal photo is genuinely persisted onto policy.avatarURL — the leak survives a reload:
Removing the owner subscript from getIconsForPolicyExpenseChat, or clearing the getWorkspaceIcon module cache, only changes what is drawn; the bad write still lands.
The report.policyAvatar fallback is read-only: grep policyAvatar src/libs/actions/ returns nothing, so it is backend-denormalized and only consulted while the policy is still loading. Any issue there is a transient loading-window bug and a backend fix, out of App scope.
The subscript theory also fails the video: the final frame shows the large primary square icon become the photo, and a subscript-only change (icons[1]) cannot move icons[0]. Those theories would also fire for any no-custom-avatar workspace on any avatar change, with no need to have just created one — which is not what the report describes.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 17:47:43 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After the user uploads a new profile photo (Account > Profile > avatar > Upload photo), the workspace avatar of a workspace they created earlier changes to that same photo. The wrong avatar then shows in the workspace chat.
What is the root cause of that problem?
The workspace avatar is not just rendered wrong — it is really uploaded to the workspace. The new avatar-crop flow delivers the cropped profile photo to the workspace avatar picker too, which calls UpdateWorkspaceAvatar.
Evidence chain:
PR #93926 (merged 2026-07-08, in 9.4.33) migrated AvatarCropModal from a per-component modal — whose save callback could only reach its own opener — to a navigation screen that hands the image back through two global Onyx keys, AVATAR_CROP_DRAFT / AVATAR_CROP_RESULT, paired with a token:
Structural cause: the "re-adopt after refresh" effect in useAvatarCrop is instance-blind. Every mounted instance of the hook subscribes to the same global draft key, and the only guard compares two global strings — Navigation.getActiveRoute() vs draft.openerKey — which are identical for every instance. Nothing identifies which picker actually opened the crop, so every mounted picker with no token of its own adopts the profile crop's token:
This is why repro step 2 ("Create a workspace") is required: creating a workspace lands on workspace settings, whose Overview page renders its own AvatarWithImagePicker (
). Navigating to Account > Profile pushes settings on top; the workspace screen stays mounted and reactive underneath, so its effect runs and adopts the token.
On save, the crop screen writes the result under the same token (
// Clear only the result; the draft is owned (and cleared) by the crop screen on unmount.
clearAvatarCropResult();
onCropped(image);
},[result,onCropped]);
) then matches in both instances: the profile form stores the image for updateAvatar, and the workspace picker's onCropped immediately calls updateWorkspaceAvatar(policyID, policy.avatarURL, file) (
This explains every detail: why the workspace must be created first, why the change survives navigation/refresh (server-side upload), and why it reproduces on web (background stack screens stay mounted).
All affected paths — any pair of simultaneously mounted pickers collides, in either direction: workspace avatar (WorkspaceOverviewPage), new-workspace form (WorkspaceConfirmationForm), WorkspaceDuplicateForm, group-chat avatar (NewChatConfirmPage, DynamicReportDetailsPage), agent avatar (EditAgentAvatarPage), and profile (useProfileAvatarForm.ts#L51). One shared-hook fix covers all of them.
What changes do you think we should make in order to solve the problem?
Fix inside useAvatarCrop only. Adoption exists solely to recover a draft orphaned by a page refresh — in a live session the opener already holds the token in its tokenRef. So record live ownership at module scope and refuse adoption of an owned token:
// useAvatarCrop.tsletsessionOwnedToken: string|null=null;// token held by a live openerconstopenCropper=(image: FileObject)=>{consttoken=rand64();tokenRef.current=token;sessionOwnedToken=token;// ...unchanged};// re-adoption effect, first guard:if(tokenRef.current||!draft?.token||!draft.openerKey||draft.token===sessionOwnedToken){return;}
openCropper sets the flag synchronously before the draft is written, so no background instance can ever adopt a live token. After a refresh the module resets to null, the draft is genuinely orphaned, and only the URL-derived stack is remounted, so the existing openerKey route check re-ties the draft to the true opener exactly as designed. Regression safety in one sentence: the token/result flow, refresh recovery, and all opener callbacks are unchanged — the guard only blocks adoption while the real opener is still alive. I'd add a unit test covering "second mounted hook must not adopt a live draft".
Why the obvious spot-fix fails: gating adoption on useIsFocused() breaks the one scenario adoption exists for — after a mid-crop refresh the opener sits under the crop screen and is never focused, and by the time focus returns, the crop screen's unmount cleanup has already cleared the draft (AvatarCropPage.tsx#L39), so refresh recovery silently dies. Likewise, capturing "my own route" in a ref at mount doesn't work: during post-refresh state reconstruction Navigation.getActiveRoute() returns the crop route for every remounting screen, so the true opener cannot learn its own path that way.
What alternative solutions did you explore? (Optional)
Per-instance route identity — compare draft.openerKey against the instance's own screen path (useRoute() + linking-config path serialization) instead of the global focused route. Also correct, but requires a reliable per-screen route→URL serialization and extra plumbing; the one-variable ownership guard achieves the same with zero added per-render work.
useIsFocused() gate on adoption/consumption — incomplete, as shown above (kills refresh recovery, races the draft cleanup).
Revert #93926 — not appropriate; the modal→screen migration was intentional (navigable/deep-linkable crop screen). The fix should preserve it, and the guard above does.
Please re-state the problem that we are trying to solve in this issue.
On Web, after a user creates a workspace and then uploads a new personal profile photo (Account > Profile > avatar > Upload photo), navigating to the workspace chat shows the newly-uploaded personal photo in the workspace chat's avatar area (as the subscript of the SubscriptAvatar). Expected: the workspace chat's avatar display should be driven entirely by the workspace's own avatar data and should never change in response to personal profile photo changes.
What is the root cause of that problem?
getIconsForPolicyExpenseChat at src/libs/ReportUtils.ts:3848 unconditionally builds a memberIcon via getParticipantIcon(report.ownerAccountID, personalDetails, translate, true) (line 3858) and returns it as icons[1]. getParticipantIcon at line 3696 reads source: details?.avatar ?? getDefaultAvatarURL({accountID}) — directly from live Onyx personalDetails. For a workspace the current user just created, ownerAccountID equals the current user's account ID, so icons[1].source is literally the current user's live personal avatar.
When updateAvatar (src/libs/actions/PersonalDetails.ts:353) writes the new photo to ONYXKEYS.PERSONAL_DETAILS_LIST[currentUserAccountID].avatar, Onyx triggers a re-render of every consumer of personalDetails. getIconsForPolicyExpenseChat re-runs, getParticipantIcon reads the new URL, and icons[1].source flips to the uploaded personal photo. The workspace chat's SubscriptAvatar renders this as its subscript — the user perceives the workspace avatar as having changed to their personal photo.
Note: icons[0] (workspaceIcon) is built from policy.avatarURL ?? getDefaultWorkspaceAvatar(workspaceName) and is not affected by personal detail changes. The visual artifact is on icons[1].
What changes do you think we should make in order to solve the problem?
The working analog is getIconsForPolicyRoom (src/libs/ReportUtils.ts:3829) and getIconsForUserCreatedPolicyRoom (line 3962): both return [workspaceIcon] only, with no member icon derived from personal details. getIconsForPolicyExpenseChat should follow the same pattern.
The personalDetails and translate parameters become unused and can be removed from the signature once callers at getIcons (line 4027) are updated to match.
Change 2 — Add a regression test in tests/unit/ReportUtilsTest.ts:
Create a policyExpenseChat report with ownerAccountID = currentUserAccountID. Assert that getIcons(report, ...) returns exactly one icon whose source matches the workspace avatar (not personalDetails[currentUserAccountID].avatar). Then mutate personalDetails[currentUserAccountID].avatar to a new URL and assert getIcons(report, ...)[0].source is unchanged.
Why getIconsForExpenseReport does NOT need the same fix
getIconsForExpenseReport (src/libs/ReportUtils.ts:3865) returns [memberIcon, workspaceIcon] — memberIcon is icons[0] (the primary avatar). In an expense report, the submitter's personal avatar IS the correct primary avatar to display; it is expected to update when personal details change. No change is needed there.
What alternative solutions did you explore?
Condition the fix on policy.avatarURL === undefined: Rejected — even workspaces with a custom avatarURL still emit a memberIcon from live personal details in the current code, so the bug would persist for those workspaces. The fix must be unconditional.
Fall back to the workspace default inside getParticipantIcon when called from a policy-expense-chat context: Rejected — this adds a context signal parameter to a general-purpose helper, increasing coupling. The clean fix is at the call site (getIconsForPolicyExpenseChat) following the established pattern of sibling functions.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 17:52:51 UTC.
Proposal
What is the root cause of that problem?
Saving a new profile picture only calls the profile avatar save path and updateAvatar(), whose optimistic/success/failure data is scoped to PERSONAL_DETAILS_LIST. That makes the personal avatar upload the trigger, not the place where workspace avatar data should be changed.
The workspace chat avatar shown in the bug comes from the policy expense chat icon path: getIconsForPolicyExpenseChat() returns the workspace icon first and the report owner/member icon second, and ReportActionAvatars renders those icons in the header/list avatar UI.
getWorkspaceIcon() caches workspace icons by policy ID/name. It resolves the source from policy.avatarURL when policy data exists, otherwise from report.policyAvatar, otherwise from getDefaultWorkspaceAvatar(workspaceName). The cache then returns the old icon whenever the current policyAvatarURL is undefined, even if policy data is now available and the correct resolved source is the default workspace avatar. So if a temporary report-level workspace avatar fallback is the user's newly uploaded avatar, that source can be cached and kept for the workspace after the policy resolves with no custom avatarURL.
What changes do you think we should make in order to solve the problem?
Update getWorkspaceIcon() so the cache is only reused when it matches the currently resolved workspace source, except for the existing "policy data is unavailable" fallback case.
Concretely, split source resolution into two states: whether a policy object was found, and which workspace source should be used. If a policy object exists but policy.avatarURL is empty, resolve to getDefaultWorkspaceAvatar(workspaceName) and refresh the cache with that default icon. Only use report.policyAvatar while policy data is unavailable, and only keep a cached icon for an undefined report fallback when policy data is still unavailable. This preserves the report-level fallback for loading/offline cases, but prevents a cached user-avatar fallback from surviving after the app knows the workspace has no custom avatar.
Because policy expense chat avatars, report avatar preview, workspace rooms, expense reports, invoice icons, and workspace search cells all rely on getWorkspaceIcon(), fixing the helper keeps the rendering consistent instead of patching only the workspace chat screen.
Add a unit test for getWorkspaceIcon() that first caches a report-level policyAvatar, then calls the helper with the same policy ID and a policy object whose avatarURL is empty; assert the returned source is getDefaultWorkspaceAvatar(workspaceName).
Add a companion test where policy data is unavailable and a real report.policyAvatar exists; assert the report fallback is still returned.
Add/update a regression test around profile avatar upload followed by opening the user's policy expense chat; assert a workspace with no custom avatar still shows the default workspace avatar while the member avatar shows the new user photo.
What alternative solutions did you explore? (Optional)
One alternative is to make updateAvatar() clear or rewrite policy expense chat avatar fields after a personal avatar upload. I would avoid that because the profile avatar action correctly only updates personal details, and coupling it to workspace reports would miss reports loaded later.
Another alternative is to compare report.policyAvatar against the report owner's personal avatar and reject matching values. That is less precise because a workspace could intentionally use the same image as its owner, and it still would not address the stale cache condition. The shared helper should instead use policy data precedence and cache invalidation to decide the workspace source.
src/pages/workspace/receiptPartners/ChangeReceiptBillingAccountPage.tsx:72 is the first concrete decision that matches workspace, avatar, change, and src/pages/media/AttachmentModalScreen/routes/WorkspaceAvatarModalContent.tsx:26 is the next matching consumer/mutation. The failing behavior is introduced at this handoff: the second path does not preserve the condition/state established by the first path for the repro case.
What changes do you think we should make in order to solve the problem?
Change the issue-matching decision at src/pages/workspace/receiptPartners/ChangeReceiptBillingAccountPage.tsx:72 so the workspace, avatar, change repro state is represented before src/pages/media/AttachmentModalScreen/routes/WorkspaceAvatarModalContent.tsx:26 consumes it.
Keep the patch at this first decision/consumer boundary (move the rule into the shared selector/helper) instead of masking the downstream UI symptom.
Keep the change inside the Workspace, Policy, Categories, Tags, Rules surface and avoid changing account/admin permission surfaces, policy owner/current-user exceptions.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Add or update a regression in tests/unit/Policy*.ts for the exact issue flow: Workspace - Workspace avatar changes to user avatar after changing user avatar.
Cover the counter-case near src/pages/workspace/receiptPartners/ChangeReceiptBillingAccountPage.tsx:72 so valid existing workspace, avatar, change behavior still works.
Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.
What alternative solutions did you explore? (Optional)
I would not add a broad new condition outside these referenced paths; the safer fix is to keep workspace, avatar, change consistent at the first read/write boundary shown above.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Open App
Go to Account > Profile and note your current profile photo.
Create a workspace (this lands on Workspace Overview, which mounts its own avatar picker) and note that its avatar is the default letter avatar.
Without navigating away from the workspace, go to Account > Profile.
Click the profile avatar, click Upload photo, choose a photo, and save it on the crop screen.
Verify the profile avatar updates to the photo you uploaded.
Go back to the workspace's Overview page and verify its avatar is unchanged (still the default letter avatar).
Verify the workspace avatar is also unchanged in the workspace chat and in the workspace list.
Activity
applause-bot commentedon Jul 10, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/b7ad7216a76852328f7fbf8dd2e9e3b116607c8e35a137958d9a442766925469
MelvinBot commentedon Jul 10, 2026
Proposal
Root Cause
The workspace chat (policy expense chat) avatar is a two‑part avatar: a primary workspace icon plus an owner/member subscript. The primary workspace image is not affected by a user avatar change — for a freshly created workspace
avatarURLis empty, so the primary is the deterministic name‑derived default building SVG. What actually changes is the subscript, which is the owner's personal avatar. Since the reporter created the workspace, they are the owner, so the subscript is their avatar — and it updates the moment they upload a new profile photo.[workspaceIcon, memberIcon]ingetIconsForPolicyExpenseChat(src/libs/ReportUtils.ts:3857-3858), where the subscript isgetParticipantIcon(report.ownerAccountID, ...).source: details?.avatar ?? …(src/libs/ReportUtils.ts:3696).PERSONAL_DETAILS_LIST[accountID].avatar = file.uri(src/libs/actions/PersonalDetails.ts:367).policy.avatarURL/report.policyAvatar, falling back to a default SVG:getWorkspaceIcon(src/libs/ReportUtils.ts:3445-3468).So there is no state leak — personal and workspace avatars are separate. The perceived "workspace avatar changed" is the owner subscript re‑rendering with the new photo.
Investigation details & data flow
ownerAccountID = currentUserAccountID, emptyavatarURL/policyAvatar(buildOptimisticWorkspaceChats,ReportUtils.ts:8632; new‑policy defaultavatarURL: ''atPolicy.ts:462).getIcons→getIconsForPolicyExpenseChat→[default building icon, owner subscript = current user].updateAvatarmerges intoPERSONAL_DETAILS_LIST[accountID].avataronly (no policy write).personalDetails[ownerAccountID].avatar→ shows the new photo.Alternatives considered: a backend leak writing the user avatar into the policy's
avatarURLwas ruled out on the client side —updateAvatarnever touches anyCOLLECTION.POLICYkey, and the workspace‑icon read path never reads personal details. The change is entirely explained by the client‑side subscript logic above.Proposed Change (if this is deemed a bug)
If the intent is that a workspace chat's avatar must not track the owner's personal photo, the change belongs at the subscript resolution in
getIconsForPolicyExpenseChat(ReportUtils.ts:3858) — e.g. stop using the owner's live personal avatar as the workspace‑chat subscript. This needs a product decision first, because showing the member as the subscript on a policy expense chat is the current intended design.Related (not a duplicate):
Expensify/App#93083(Avatars: Default to Letters, recently closed) touched default‑avatar rendering.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/95854)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
MobileMage commentedon Jul 10, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 17:40:08 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace is created without uploading a workspace avatar, changing the user's own account avatar (Account > Profile > Upload photo) makes the workspace's avatar in the workspace chat change to the new personal photo. The expected behavior is that the workspace keeps its stable default avatar and does not track the user's personal avatar.
What is the root cause of that problem?
PR #93926 moved avatar cropping from a per-component modal to a shared crop screen that communicates through two global Onyx singletons,
AVATAR_CROP_DRAFTandAVATAR_CROP_RESULT(src/ONYXKEYS.tsL103/L106), paired with a random token. When a picker opens the cropper,useAvatarCropstores the token in its owntokenRefand persists a draft whoseopenerKeyis the globally focused route:https://github.com/Expensify/App/blob/main/src/hooks/useAvatarCrop.ts#L43-L57
The hook also has a re-adoption effect meant to recover a draft orphaned by a page refresh (L63-L83). That effect runs in every mounted instance of the hook whenever the draft changes, and its only ownership test compares two global values: the currently focused path (minus the crop suffix) against
draft.openerKey(L76-L80). Nothing in the check identifies which picker actually opened the crop, so every mounted instance with an emptytokenRefadopts the token.The repro wires this up exactly. Creating a workspace lands on the workspace split navigator whose default central screen is
WorkspaceOverviewPage(WorkspaceSplitNavigator.tsxL57), which mounts its ownAvatarWithImagePickerand therefore its ownuseAvatarCropinstance (WorkspaceOverviewPage.tsxL525,AvatarWithImagePicker.tsxL120). Navigating to Account > Profile pushes the settings navigator on top, but the workspace screen is not frozen:freezeNonTopScreensis only enabled inside split navigators (createSplitNavigator/index.tsxL48), the Overview page remains the top central screen of its own split, and the root stack applies no freezing at all. The background workspace picker keeps reacting to Onyx. When the profile avatar form opens the cropper (useProfileAvatarForm.tsL51), the workspace instance's adoption effect sees the new draft, the focused-route comparison passes (it is a global fact, identical for every instance), and it silently adopts the profile crop's token.On crop save,
AvatarCropPagewrites the result under that token (AvatarCropPage.tsxL53-L56) and the consume effect (useAvatarCrop.tsL85-L94) fires in both instances. The profile form merely stages the image for a later Save, but the workspace picker'sonCroppedimmediately callsupdateWorkspaceAvatar(policyID, policy.avatarURL, file)(WorkspaceOverviewPage.tsxL544-L548), which optimistically setspolicy.avatarURLand sendsUpdateWorkspaceAvatarto the server (Policy.tsL1779-L1822). The user's cropped profile photo is genuinely persisted as the workspace avatar. That is why the change survives refresh and shows in the workspace chat, wheregetWorkspaceIcon(ReportUtils.tsL3445-L3452) is faithfully rendering the now-corruptedpolicy.avatarURL.Timing confirms the regression: the #93926 merge is an ancestor of the 9.4.29-1 version bump and therefore present in the reported 9.4.33-0, and the issue was filed as an exploratory regression two days after that PR shipped.
What changes do you think we should make in order to solve the problem?
Give each crop a stable identity for what avatar is being edited, and only let the instance editing that same target adopt the draft:
useAvatarCropaccepts atargetKey: stringparam;openCropperwrites it into the draft (extendSetAvatarCropDraftParamsinsrc/libs/actions/AvatarCrop.tsandAvatarCropDraftinsrc/types/onyx/AvatarCropDraft.ts).AvatarWithImagePickeralready receivestypeandavatarIDprops and can derivetargetKeyas`${type}-${String(avatarID)}`(e.g.workspace-<policyID>fromWorkspaceOverviewPage.tsxL533); the profile form passes a profile key (e.g.avatar-<accountID>). If a caller provides no key, fall back to today's route-only check so unkeyed callers degrade to current behavior rather than breaking.This shape is immune to the Onyx hydration race: the guard compares the draft against a stable value derived from props, so it does not matter when
useOnyxdelivers the draft. It also survives refresh by construction, because the key is recomputed from policyID/accountID on remount, so the true opener re-adopts exactly as the effect intends while background pickers (different targets) can never adopt. The existingopenerKeyfocused-route check stays as a secondary guard. Two co-mounted instances with the sametargetKeywould both deliver, but same target means the same semantic update, so that is harmless.Tests: (a) two hooks with different target keys, draft written for A, only A's
onCroppedfires when the result lands; (b) refresh simulation, a fresh mount with a pre-existing draft whosetargetKeymatches re-adopts afterisNavigationReady(); (c) flow regression, with a background workspace Overview mounted, a profile crop must not callupdateWorkspaceAvatarandpolicy.avatarURLstays empty.What alternative solutions did you explore? (Optional)
Snapshotting the live token at mount (via a hydration-safe read like
useInitialOnyxValue) closes the refresh race but still lets a picker that first hydrates while a crop is live snapshot-and-adopt the live token. Capturing "my own route" at mount does not survive refresh, because during state reconstructionNavigation.getActiveRoute()returns the crop route for every remounting screen, so background pickers would capture the opener's route and still collide. A module-scoped "live token" flag also fixes the repro but adds shared mutable state that is awkward to reset and test. The target-key identity avoids all three holes.An earlier revision of this proposal read the symptom as a display-layer fallback in
getWorkspaceIconwith backend-seededavatarURL. The regression timing and the write path above rule that out: the avatar change is a real client-initiatedUpdateWorkspaceAvatarpersisted server-side, so any render-side guard would only mask corrupted data (and would break owners who deliberately use the same photo for profile and workspace).shivang-goliyan commentedon Jul 10, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-13 22:27:19 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Right after creating a workspace, if you go to Account > Profile and change your personal avatar, the workspace's avatar changes to that same photo. The workspace should keep its own avatar and ignore edits to your personal one.
What is the root cause of that problem?
This is a real persisted write, not a render artifact. When you save the profile crop, a background
updateWorkspaceAvatarAPI call actually fires and writespolicy.avatarURLto your personal photo.The collision lives in the re-adoption effect in
src/hooks/useAvatarCrop.ts:63-83. That effect is instance-blind. Its only ownership test (lines 76-78) compares the global focused routeNavigation.getActiveRoute()(with the/avatar-cropsuffix stripped) againstdraft.openerKey. Both are the same global string for every mounted instance of the hook — nothing identifies which picker actually opened the crop. Its deps are[draft?.token, draft?.openerKey], so it runs the moment the profile picker writesAVATAR_CROP_DRAFT, in the normal flow, not just on refresh.Trace it against the exact repro steps:
WorkspaceOverviewPage, which mounts its ownuseAvatarCropwithtokenRef = null(src/pages/workspace/WorkspaceOverviewPage.tsx:540-545wires its picker'sonImageSelectedtoupdateWorkspaceAvatar(policyID, policy.avatarURL, file)).AVATAR_CROP_DRAFT{token, openerKey: <profile route>}and navigates to<profile route>/avatar-crop.tokenRefis null, the focused path minus suffix is<profile route>, which equalsdraft.openerKey— so it adopts the profile token as its own.AVATAR_CROP_RESULTcarries that token, which now matchestokenRefin both the profile instance and the workspace instance (useAvatarCrop.ts:85-94). BothonCroppedcallbacks fire.AvatarWithImagePicker.tsx:120wiresonCropped: onImageSelected, so the workspace instance callsupdateWorkspaceAvatarwith your personal photo.This also explains why "Create a workspace" is a required repro step: you have to be sitting on a page with a live, mounted workspace picker for the two instances to collide.
What changes do you think we should make in order to solve the problem?
Gate re-adoption to the instance that actually owns the draft. The check at
useAvatarCrop.ts:76-78needs an instance-specific identity instead of the shared global route.There is a hazard here that decides whether the fix is correct, and it rules out the obvious implementation. The effect exists to recover an orphaned crop after a cold refresh, so the guard cannot simply snapshot the draft at mount:
useOnyxhydrates asynchronously, so on a cold web refreshdraftisundefinedon the first render. A naiveuseRef(draft?.token)capturesnull, and then rejects the very orphaned token it was meant to re-adopt — silently breaking refresh recovery while appearing to fix the reported bug.So the guard has to be hydration-aware. Use the existing
useInitialOnyxValuehelper to snapshot the draft at Onyxloadedrather than at first render, and compare re-adoption against that instance-local snapshot. Cold-refresh recovery keeps working, and the workspace instance no longer matches the profile token, so the strayupdateWorkspaceAvatarnever fires.Add a test that mounts two
AvatarWithImagePickerinstances (workspace + profile), triggers a profile crop, and assertsupdateWorkspaceAvataris not called — that is the exact path that shipped broken. A second test should cold-mount with Onyx unhydrated and assert the orphaned draft is still re-adopted, which is the case a first-render ref snapshot regresses.What alternative solutions did you explore? (Optional)
Render-side fixes do not work here, because the personal photo is genuinely persisted onto
policy.avatarURL— the leak survives a reload:getIconsForPolicyExpenseChat, or clearing thegetWorkspaceIconmodule cache, only changes what is drawn; the bad write still lands.report.policyAvatarfallback is read-only:grep policyAvatar src/libs/actions/returns nothing, so it is backend-denormalized and only consulted while the policy is still loading. Any issue there is a transient loading-window bug and a backend fix, out of App scope.The subscript theory also fails the video: the final frame shows the large primary square icon become the photo, and a subscript-only change (
icons[1]) cannot moveicons[0]. Those theories would also fire for any no-custom-avatar workspace on any avatar change, with no need to have just created one — which is not what the report describes.ahmdshrif commentedon Jul 10, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 17:47:43 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After the user uploads a new profile photo (Account > Profile > avatar > Upload photo), the workspace avatar of a workspace they created earlier changes to that same photo. The wrong avatar then shows in the workspace chat.
What is the root cause of that problem?
The workspace avatar is not just rendered wrong — it is really uploaded to the workspace. The new avatar-crop flow delivers the cropped profile photo to the workspace avatar picker too, which calls
UpdateWorkspaceAvatar.Evidence chain:
PR
#93926(merged 2026-07-08, in 9.4.33) migratedAvatarCropModalfrom a per-component modal — whose save callback could only reach its own opener — to a navigation screen that hands the image back through two global Onyx keys,AVATAR_CROP_DRAFT/AVATAR_CROP_RESULT, paired with a token:App/src/ONYXKEYS.ts
Lines 103 to 106 in 5ee0283
When the profile flow opens the cropper,
openCropperstores a draft{token, openerKey}whereopenerKeyis the focused route:App/src/hooks/useAvatarCrop.ts
Lines 43 to 57 in 5ee0283
Structural cause: the "re-adopt after refresh" effect in
useAvatarCropis instance-blind. Every mounted instance of the hook subscribes to the same global draft key, and the only guard compares two global strings —Navigation.getActiveRoute()vsdraft.openerKey— which are identical for every instance. Nothing identifies which picker actually opened the crop, so every mounted picker with no token of its own adopts the profile crop's token:App/src/hooks/useAvatarCrop.ts
Lines 63 to 83 in 5ee0283
This is why repro step 2 ("Create a workspace") is required: creating a workspace lands on workspace settings, whose Overview page renders its own
AvatarWithImagePicker(App/src/pages/workspace/WorkspaceOverviewPage.tsx
Line 525 in 5ee0283
AvatarWithImagePickermounts its ownuseAvatarCrop(App/src/components/AvatarWithImagePicker.tsx
Line 120 in 5ee0283
On save, the crop screen writes the result under the same token (
App/src/pages/AvatarCropPage.tsx
Lines 54 to 56 in 5ee0283
App/src/hooks/useAvatarCrop.ts
Lines 85 to 94 in 5ee0283
updateAvatar, and the workspace picker'sonCroppedimmediately callsupdateWorkspaceAvatar(policyID, policy.avatarURL, file)(App/src/pages/workspace/WorkspaceOverviewPage.tsx
Lines 544 to 548 in 5ee0283
The workspace chat then correctly renders
policy.avatarURL— now the user's photo — as the workspace icon viagetWorkspaceIcon:App/src/libs/ReportUtils.ts
Lines 3445 to 3452 in 5ee0283
This explains every detail: why the workspace must be created first, why the change survives navigation/refresh (server-side upload), and why it reproduces on web (background stack screens stay mounted).
All affected paths — any pair of simultaneously mounted pickers collides, in either direction: workspace avatar (
WorkspaceOverviewPage), new-workspace form (WorkspaceConfirmationForm),WorkspaceDuplicateForm, group-chat avatar (NewChatConfirmPage,DynamicReportDetailsPage), agent avatar (EditAgentAvatarPage), and profile (useProfileAvatarForm.ts#L51). One shared-hook fix covers all of them.What changes do you think we should make in order to solve the problem?
Fix inside
useAvatarCroponly. Adoption exists solely to recover a draft orphaned by a page refresh — in a live session the opener already holds the token in itstokenRef. So record live ownership at module scope and refuse adoption of an owned token:openCroppersets the flag synchronously before the draft is written, so no background instance can ever adopt a live token. After a refresh the module resets tonull, the draft is genuinely orphaned, and only the URL-derived stack is remounted, so the existingopenerKeyroute check re-ties the draft to the true opener exactly as designed. Regression safety in one sentence: the token/result flow, refresh recovery, and all opener callbacks are unchanged — the guard only blocks adoption while the real opener is still alive. I'd add a unit test covering "second mounted hook must not adopt a live draft".Why the obvious spot-fix fails: gating adoption on
useIsFocused()breaks the one scenario adoption exists for — after a mid-crop refresh the opener sits under the crop screen and is never focused, and by the time focus returns, the crop screen's unmount cleanup has already cleared the draft (AvatarCropPage.tsx#L39), so refresh recovery silently dies. Likewise, capturing "my own route" in a ref at mount doesn't work: during post-refresh state reconstructionNavigation.getActiveRoute()returns the crop route for every remounting screen, so the true opener cannot learn its own path that way.What alternative solutions did you explore? (Optional)
draft.openerKeyagainst the instance's own screen path (useRoute()+ linking-config path serialization) instead of the global focused route. Also correct, but requires a reliable per-screen route→URL serialization and extra plumbing; the one-variable ownership guard achieves the same with zero added per-render work.useIsFocused()gate on adoption/consumption — incomplete, as shown above (kills refresh recovery, races the draft cleanup).#93926— not appropriate; the modal→screen migration was intentional (navigable/deep-linkable crop screen). The fix should preserve it, and the guard above does.aswin-s commentedon Jul 10, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web, after a user creates a workspace and then uploads a new personal profile photo (Account > Profile > avatar > Upload photo), navigating to the workspace chat shows the newly-uploaded personal photo in the workspace chat's avatar area (as the subscript of the SubscriptAvatar). Expected: the workspace chat's avatar display should be driven entirely by the workspace's own avatar data and should never change in response to personal profile photo changes.
What is the root cause of that problem?
getIconsForPolicyExpenseChatat src/libs/ReportUtils.ts:3848 unconditionally builds amemberIconviagetParticipantIcon(report.ownerAccountID, personalDetails, translate, true)(line 3858) and returns it asicons[1].getParticipantIconat line 3696 readssource: details?.avatar ?? getDefaultAvatarURL({accountID})— directly from live OnyxpersonalDetails. For a workspace the current user just created,ownerAccountIDequals the current user's account ID, soicons[1].sourceis literally the current user's live personal avatar.When
updateAvatar(src/libs/actions/PersonalDetails.ts:353) writes the new photo toONYXKEYS.PERSONAL_DETAILS_LIST[currentUserAccountID].avatar, Onyx triggers a re-render of every consumer ofpersonalDetails.getIconsForPolicyExpenseChatre-runs,getParticipantIconreads the new URL, andicons[1].sourceflips to the uploaded personal photo. The workspace chat's SubscriptAvatar renders this as its subscript — the user perceives the workspace avatar as having changed to their personal photo.Note:
icons[0](workspaceIcon) is built frompolicy.avatarURL ?? getDefaultWorkspaceAvatar(workspaceName)and is not affected by personal detail changes. The visual artifact is onicons[1].What changes do you think we should make in order to solve the problem?
The working analog is
getIconsForPolicyRoom(src/libs/ReportUtils.ts:3829) andgetIconsForUserCreatedPolicyRoom(line 3962): both return[workspaceIcon]only, with no member icon derived from personal details.getIconsForPolicyExpenseChatshould follow the same pattern.Change 1 — src/libs/ReportUtils.ts:3848-3860 (
getIconsForPolicyExpenseChat):Remove the
memberIconderivation entirely and return only[workspaceIcon]:The
personalDetailsandtranslateparameters become unused and can be removed from the signature once callers atgetIcons(line 4027) are updated to match.Change 2 — Add a regression test in
tests/unit/ReportUtilsTest.ts:Create a policyExpenseChat report with
ownerAccountID = currentUserAccountID. Assert thatgetIcons(report, ...)returns exactly one icon whosesourcematches the workspace avatar (notpersonalDetails[currentUserAccountID].avatar). Then mutatepersonalDetails[currentUserAccountID].avatarto a new URL and assertgetIcons(report, ...)[0].sourceis unchanged.Why
getIconsForExpenseReportdoes NOT need the same fixgetIconsForExpenseReport(src/libs/ReportUtils.ts:3865) returns[memberIcon, workspaceIcon]—memberIconisicons[0](the primary avatar). In an expense report, the submitter's personal avatar IS the correct primary avatar to display; it is expected to update when personal details change. No change is needed there.What alternative solutions did you explore?
policy.avatarURL === undefined: Rejected — even workspaces with a customavatarURLstill emit amemberIconfrom live personal details in the current code, so the bug would persist for those workspaces. The fix must be unconditional.getParticipantIconwhen called from a policy-expense-chat context: Rejected — this adds a context signal parameter to a general-purpose helper, increasing coupling. The clean fix is at the call site (getIconsForPolicyExpenseChat) following the established pattern of sibling functions.KJ21-ENG commentedon Jul 10, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-10 17:52:51 UTC.
Proposal
What is the root cause of that problem?
Saving a new profile picture only calls the profile avatar save path and
updateAvatar(), whose optimistic/success/failure data is scoped toPERSONAL_DETAILS_LIST. That makes the personal avatar upload the trigger, not the place where workspace avatar data should be changed.App/src/pages/settings/Profile/Avatar/useProfileAvatarForm.ts
Lines 58 to 72 in 5ee0283
App/src/libs/actions/PersonalDetails.ts
Lines 353 to 413 in 5ee0283
The workspace chat avatar shown in the bug comes from the policy expense chat icon path:
getIconsForPolicyExpenseChat()returns the workspace icon first and the report owner/member icon second, andReportActionAvatarsrenders those icons in the header/list avatar UI.App/src/libs/ReportUtils.ts
Lines 3848 to 3859 in 5ee0283
App/src/components/ReportActionAvatars/index.tsx
Lines 170 to 218 in 5ee0283
getWorkspaceIcon()caches workspace icons by policy ID/name. It resolves the source frompolicy.avatarURLwhen policy data exists, otherwise fromreport.policyAvatar, otherwise fromgetDefaultWorkspaceAvatar(workspaceName). The cache then returns the old icon whenever the currentpolicyAvatarURLisundefined, even if policy data is now available and the correct resolved source is the default workspace avatar. So if a temporary report-level workspace avatar fallback is the user's newly uploaded avatar, that source can be cached and kept for the workspace after the policy resolves with no customavatarURL.App/src/libs/ReportUtils.ts
Lines 3440 to 3468 in 5ee0283
What changes do you think we should make in order to solve the problem?
Update
getWorkspaceIcon()so the cache is only reused when it matches the currently resolved workspace source, except for the existing "policy data is unavailable" fallback case.Concretely, split source resolution into two states: whether a policy object was found, and which workspace source should be used. If a policy object exists but
policy.avatarURLis empty, resolve togetDefaultWorkspaceAvatar(workspaceName)and refresh the cache with that default icon. Only usereport.policyAvatarwhile policy data is unavailable, and only keep a cached icon for an undefined report fallback when policy data is still unavailable. This preserves the report-level fallback for loading/offline cases, but prevents a cached user-avatar fallback from surviving after the app knows the workspace has no custom avatar.App/src/libs/ReportUtils.ts
Lines 3445 to 3468 in 5ee0283
Because policy expense chat avatars, report avatar preview, workspace rooms, expense reports, invoice icons, and workspace search cells all rely on
getWorkspaceIcon(), fixing the helper keeps the rendering consistent instead of patching only the workspace chat screen.App/src/libs/ReportUtils.ts
Lines 3828 to 3859 in 5ee0283
Test coverage:
getWorkspaceIcon()that first caches a report-levelpolicyAvatar, then calls the helper with the same policy ID and a policy object whoseavatarURLis empty; assert the returned source isgetDefaultWorkspaceAvatar(workspaceName).report.policyAvatarexists; assert the report fallback is still returned.What alternative solutions did you explore? (Optional)
One alternative is to make
updateAvatar()clear or rewrite policy expense chat avatar fields after a personal avatar upload. I would avoid that because the profile avatar action correctly only updates personal details, and coupling it to workspace reports would miss reports loaded later.Another alternative is to compare
report.policyAvataragainst the report owner's personal avatar and reject matching values. That is less precise because a workspace could intentionally use the same image as its owner, and it still would not address the stale cache condition. The shared helper should instead use policy data precedence and cache invalidation to decide the workspace source.godzillaxbox19982014-lgtm commentedon Jul 10, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace - Workspace avatar changes to user avatar after changing user avatar
What is the root cause of that problem?
I traced this to the path that handles
workspace, avatar, change:ChangeReceiptBillingAccountPage):source: personalDetail?.avatar ?? icons.FallbackAvatar,avatarURL):const avatarURL = policy?.avatarURL ?? getDefaultWorkspaceAvatar(policy?.name ?? fallbackLetter);requestWorkspaceOwnerChange):requestWorkspaceOwnerChange(policy, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login ?? '');requestWorkspaceOwnerChange):requestWorkspaceOwnerChange(policy, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login ?? '');src/pages/workspace/receiptPartners/ChangeReceiptBillingAccountPage.tsx:72is the first concrete decision that matchesworkspace, avatar, change, andsrc/pages/media/AttachmentModalScreen/routes/WorkspaceAvatarModalContent.tsx:26is the next matching consumer/mutation. The failing behavior is introduced at this handoff: the second path does not preserve the condition/state established by the first path for the repro case.What changes do you think we should make in order to solve the problem?
src/pages/workspace/receiptPartners/ChangeReceiptBillingAccountPage.tsx:72so theworkspace, avatar, changerepro state is represented beforesrc/pages/media/AttachmentModalScreen/routes/WorkspaceAvatarModalContent.tsx:26consumes it.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
tests/unit/Policy*.tsfor the exact issue flow: Workspace - Workspace avatar changes to user avatar after changing user avatar.src/pages/workspace/receiptPartners/ChangeReceiptBillingAccountPage.tsx:72so valid existingworkspace, avatar, changebehavior still works.What alternative solutions did you explore? (Optional)
workspace, avatar, changeconsistent at the first read/write boundary shown above.melvin-bot commentedon Jul 10, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (
External)41 remaining items
melvin-bot commentedon Aug 5, 2026
@ZhenjaHorbach Eep! 4 days overdue now. Issues have feelings too...
ZhenjaHorbach commentedon Aug 6, 2026
BugZero Checklist:
https://github.com/Expensify/App/pull/93926/changes#r3726917521
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-2e0c-a673-6704-8f24106bec64melvin-bot commentedon Aug 6, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 6, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Aug 8, 2026
Payment Summary
Contributor: @ahmdshrif paid $250 via Upwork
Contributor+: @ZhenjaHorbach due $250 via NewDot
garrettmknight commentedon Aug 10, 2026
$250 approved for @ZhenjaHorbach