profile: bootstrap avatar URL on app boot
The appbar's <Avatar> reads avatarUrl from the localStorage profile mirror. Without a global fetcher, that mirror only got populated when the user navigated to /profile, so a fresh browser session showed initials in the appbar until then. - ProfileBootstrap component runs in root.tsx alongside LlmConfigBootstrap. On mount and on session change, fetches the arcadia profile and caches the resolved avatar URL. - profile.tsx loadAccount now also persists the URL into localStorage on initial fetch (was in-memory only) so it survives reloads. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,7 +115,17 @@ export default function ProfileRoute() {
|
||||
timezone: p.timezone ?? "",
|
||||
})
|
||||
const url = pickAvatarUrl(p)
|
||||
if (url) setPrefs((d) => ({ ...d, avatarUrl: url }))
|
||||
if (url) {
|
||||
// Persist into localStorage so the appbar's useProfile() picks
|
||||
// it up on next render — without this, the appbar avatar reverts
|
||||
// to initials on every fresh browser session until the user
|
||||
// re-uploads.
|
||||
setPrefs((d) => {
|
||||
const next = { ...d, avatarUrl: url }
|
||||
saveProfile(next)
|
||||
return next
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
setAccountError(
|
||||
|
||||
Reference in New Issue
Block a user