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
This issue β the investigation, evidence, and write-up β was produced by Claude (Claude Code), reviewed by a human before posting. Commit references, dates, and file paths were gathered programmatically from git history and the source repos; please still sanity-check specifics before acting on them.
Summary
The user avatar in the desktop and mobile user-menu toggles (DesktopUserMenuToggle / MobileUserMenuToggle) never displays a real image β it always falls back to the placeholder AvatarIcon.
The root cause is a single field-name mismatch: src/Header.jsx reads authenticatedUser.avatar, but no layer of the Open edX stack has ever populated an avatar field on the authenticated user. The profile image has always lived at authenticatedUser.profileImage.imageUrlMedium (populated by hydrateAuthenticatedUser()).
The Studio header hit the identical bug and was fixed in commit 38a68e5 ("fix: show hydrated profile avatars in Studio header"). The same fix was never applied to the main desktop/mobile Header.
Note: this issue is a write-up of the investigation only. It intentionally does not include a fix PR yet.
authenticatedUser.avatar is effectively always undefined, so Avatar renders the placeholder icon.
Why avatar is never set β evidence across the whole stack
Layer
What it actually provides
avatar?
edx-platform accounts API /api/user/v1/accounts/{username}
profile_image: { has_image, image_url_full/large/medium/small } β shape stable since March 2015 (46b63164a)
β never
@edx/frontend-platformhydrateAuthenticatedUser()
camelCases the above β profileImage: { hasImage, imageUrlMedium, β¦ } via setAuthenticatedUser({ ...user, ...camelCaseObject(response.data) })
β never
@edx/frontend-platform JWT-decoded user
{ email, userId, username, roles, administrator, name }
β never
@edx/frontend-auth (legacy) userAccount model
profileImage: { imageUrlMedium, imageUrlLarge }
β never
@edx/frontend-base v1.1.0 / v2.0.0 (the versions this repo pinned in 2019)
getAuthenticatedUser returns exactly { userId, username, roles, administrator } (explicit field pick β no spread, so a JWT claim couldn't leak through either)
β never
A live sample of the accounts endpoint today confirms it β profile_image.image_url_medium present, has_image: true, and no avatar key.
The correct pattern
Mirror the Studio header fix (src/studio-header/StudioHeader.tsx):
Note the profileImage.hasImage guard β when the user has no uploaded image the API still returns profile_image with has_image: false and default-image URLs, so the guard matters.
Two failure modes across consumers
Profile-image data is only present if the MFE opts into hydration β initialize({ hydrateAuthenticatedUser: true }), which defaults to false. So consumers fail in one of two ways:
Wrong field β MFEs that do hydrate (e.g. frontend-app-account, frontend-app-profile) have authenticatedUser.profileImage available, but the header reads the nonexistent .avatar.
Not hydrated β MFEs that don't opt in (e.g. frontend-app-learner-dashboard) never fetch profileImage at all, so even a corrected field read would need hydration enabled.
Historical provenance (why the code looks like this)
afe6705 (2019-09-13, initial commit): original SiteHeader.jsx destructured avatar from @edx/frontend-base's AuthenticationContext. That context never supplied avatar β and the author's own example/test mocks only set { userId, username, administrator }.
f9d1734 (2019-09-18, "upgrading to frontend-base 2.0.0"): the frontend-base 2.0 migration converted the destructured avatar into avatar: authenticatedUser.avatar β this is where the current form was introduced.
Likely origin of the field name:frontend-app-learning once contained a design doc docs/api-strawperson.js (since deleted) sketching a proposed user: { β¦, avatar: String } API shape that was never implemented. The header appears to have been written against that aspirational contract, while the shipped data always lived under profileImage.
So the avatar read has been dead on arrival since the repo's first commit; no dependency bump ever made it live.
Ecosystem audit (for completeness)
A full git-history pickaxe (git log --all -S avatar) across all 13 frontend-app-* consumers of this package found that no MFE has ever injected an avatar field onto authenticatedUser (no manual AppContext.Provider, no custom auth/hydration handler) β in current code or anywhere in history. Every avatar occurrence is incidental (Paragon <Avatar>, CSS class names, forum/API profile-image data, package-lock noise).
Two notable findings:
frontend-app-account and frontend-app-profile previously rendered their own vendored headers that read the image correctly from state.userAccount.profileImage β and regressed to a missing avatar when they adopted @edx/frontend-component-header.
The real image data is consistently sourced from profileImage.imageUrlMedium everywhere in the ecosystem (e.g. frontend-app-learner-portal-enterprise's AvatarDropdown), making this component's avatar read the lone outlier.
Suggested direction (fix deferred)
In src/Header.jsx, fall back to the hydrated profile image, mirroring the Studio fix and guarding on hasImage:
Document that consuming MFEs must call initialize({ hydrateAuthenticatedUser: true }) for the image to be available (relevant to frontend-app-learner-dashboard and any other full-Header consumer that doesn't hydrate today).
Affected files
src/Header.jsx β the buggy read (feeds both desktop and mobile).
src/desktop-header/DesktopUserMenuToggle.jsx, src/mobile-header/MobileUserMenuToggle.jsx β consume the avatar prop.
Reference for the correct pattern: src/studio-header/StudioHeader.tsx (fixed in 38a68e5).
Important
π€ Generated by Claude
This issue β the investigation, evidence, and write-up β was produced by Claude (Claude Code), reviewed by a human before posting. Commit references, dates, and file paths were gathered programmatically from git history and the source repos; please still sanity-check specifics before acting on them.
Summary
The user avatar in the desktop and mobile user-menu toggles (
DesktopUserMenuToggle/MobileUserMenuToggle) never displays a real image β it always falls back to the placeholderAvatarIcon.The root cause is a single field-name mismatch:
src/Header.jsxreadsauthenticatedUser.avatar, but no layer of the Open edX stack has ever populated anavatarfield on the authenticated user. The profile image has always lived atauthenticatedUser.profileImage.imageUrlMedium(populated byhydrateAuthenticatedUser()).The Studio header hit the identical bug and was fixed in commit
38a68e5("fix: show hydrated profile avatars in Studio header"). The same fix was never applied to the main desktop/mobileHeader.Symptom & scope
HeaderβDesktopHeaderβDesktopUserMenuToggleauthenticatedUser.avatarHeaderβMobileHeaderβMobileUserMenuToggleauthenticatedUser.avatarStudioHeaderβUserMenuauthenticatedUser.avatar || profileImage.imageUrlMedium38a68e5)LearningHeaderRoot cause
The plumbing inside this repo is correct end-to-end:
Header.jsxβDesktopHeaderSlotβDesktopHeaderβDesktopUserMenuToggleSlotβDesktopUserMenuToggleβAvatar src={avatar}The break is the source value at the top:
authenticatedUser.avataris effectively alwaysundefined, soAvatarrenders the placeholder icon.Why
avataris never set β evidence across the whole stackavatar?edx-platformaccounts API/api/user/v1/accounts/{username}profile_image: { has_image, image_url_full/large/medium/small }β shape stable since March 2015 (46b63164a)@edx/frontend-platformhydrateAuthenticatedUser()profileImage: { hasImage, imageUrlMedium, β¦ }viasetAuthenticatedUser({ ...user, ...camelCaseObject(response.data) })@edx/frontend-platformJWT-decoded user{ email, userId, username, roles, administrator, name }@edx/frontend-auth(legacy)userAccountmodelprofileImage: { imageUrlMedium, imageUrlLarge }@edx/frontend-basev1.1.0 / v2.0.0 (the versions this repo pinned in 2019)getAuthenticatedUserreturns exactly{ userId, username, roles, administrator }(explicit field pick β no spread, so a JWT claim couldn't leak through either)A live sample of the accounts endpoint today confirms it β
profile_image.image_url_mediumpresent,has_image: true, and noavatarkey.The correct pattern
Mirror the Studio header fix (
src/studio-header/StudioHeader.tsx):Note the
profileImage.hasImageguard β when the user has no uploaded image the API still returnsprofile_imagewithhas_image: falseand default-image URLs, so the guard matters.Two failure modes across consumers
Profile-image data is only present if the MFE opts into hydration β
initialize({ hydrateAuthenticatedUser: true }), which defaults tofalse. So consumers fail in one of two ways:frontend-app-account,frontend-app-profile) haveauthenticatedUser.profileImageavailable, but the header reads the nonexistent.avatar.frontend-app-learner-dashboard) never fetchprofileImageat all, so even a corrected field read would need hydration enabled.Historical provenance (why the code looks like this)
afe6705(2019-09-13, initial commit): originalSiteHeader.jsxdestructuredavatarfrom@edx/frontend-base'sAuthenticationContext. That context never suppliedavatarβ and the author's own example/test mocks only set{ userId, username, administrator }.f9d1734(2019-09-18, "upgrading to frontend-base 2.0.0"): the frontend-base 2.0 migration converted the destructuredavatarintoavatar: authenticatedUser.avatarβ this is where the current form was introduced.57e05c4(2019-11-04, Modernize build and fix the anonymous headerΒ #26): added the!== nullguard only.frontend-app-learningonce contained a design docdocs/api-strawperson.js(since deleted) sketching a proposeduser: { β¦, avatar: String }API shape that was never implemented. The header appears to have been written against that aspirational contract, while the shipped data always lived underprofileImage.So the
avatarread has been dead on arrival since the repo's first commit; no dependency bump ever made it live.Ecosystem audit (for completeness)
A full git-history pickaxe (
git log --all -S avatar) across all 13frontend-app-*consumers of this package found that no MFE has ever injected anavatarfield ontoauthenticatedUser(no manualAppContext.Provider, no custom auth/hydration handler) β in current code or anywhere in history. Everyavataroccurrence is incidental (Paragon<Avatar>, CSS class names, forum/API profile-image data, package-lock noise).Two notable findings:
frontend-app-accountandfrontend-app-profilepreviously rendered their own vendored headers that read the image correctly fromstate.userAccount.profileImageβ and regressed to a missing avatar when they adopted@edx/frontend-component-header.profileImage.imageUrlMediumeverywhere in the ecosystem (e.g.frontend-app-learner-portal-enterprise'sAvatarDropdown), making this component'savatarread the lone outlier.Suggested direction (fix deferred)
src/Header.jsx, fall back to the hydrated profile image, mirroring the Studio fix and guarding onhasImage:initialize({ hydrateAuthenticatedUser: true })for the image to be available (relevant tofrontend-app-learner-dashboardand any other full-Headerconsumer that doesn't hydrate today).Affected files
src/Header.jsxβ the buggy read (feeds both desktop and mobile).src/desktop-header/DesktopUserMenuToggle.jsx,src/mobile-header/MobileUserMenuToggle.jsxβ consume theavatarprop.src/studio-header/StudioHeader.tsx(fixed in38a68e5).