fix: recover profile and avatar loading#13
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes regressions in user profile/bio parsing and avatar rendering by making MSC4440 bio extraction defensive, recovering from certain broken profile-cache states, and resetting avatar error state when the image source changes.
Changes:
- Make
gay.fomx.biographyparsing resilient to missing/malformed MSC4440 data. - Add a retry path when the global profile cache contains only an
_fetchedmarker. - Reset avatar/room avatar error fallback state whenever
srcchanges.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app/hooks/useUserProfile.ts | Defensive MSC4440 bio parsing + retry logic for _fetched-only cache state |
| src/app/components/user-avatar/UserAvatar.tsx | Reset error state when avatar src changes to recover after transient failures |
| src/app/components/room-avatar/RoomAvatar.tsx | Same error reset behavior for room avatars when src changes |
| .changeset/fix-profile-avatar-loading.md | Adds a patch changeset entry describing the fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const hasOnlyFetchedMarker = | ||
| cached?._fetched === true && Object.keys(cached).every((key) => key === '_fetched'); | ||
|
|
||
| const needsFetch = | ||
| !!userId && userId !== 'undefined' && (!cached?._fetched || hasOnlyFetchedMarker); |
There was a problem hiding this comment.
hasOnlyFetchedMarker makes needsFetch stay true when the cache contains only { _fetched: true }. Since the .catch() handler also writes exactly that shape when the first fetch fails (when prev[userId] is undefined), this can cause a tight refetch loop (re-render → fetch → catch → atom update → re-render …), spamming mx.getProfileInfo while offline or on persistent errors. Consider adding a separate cached error/timestamp/attempt marker (so this state doesn’t immediately qualify for retry), or throttling/backing off retries (e.g., only retry once per mount / after a delay / on focus) so persistent failures don’t DOS the homeserver/client.
Deploying with
|
| Status | Preview URL | Commit | Alias | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! | https://pr-13-sable.justin-tech.workers.dev | e7fd523 | pr-13 |
Sat, 28 Mar 2026 05:27:32 GMT |
bf89a08 to
724b45f
Compare
12001e2 to
d6c8bcf
Compare
Same fix as SableClient#566, but targeting the
integrationbranch.Description
Fixes profile and avatar loading regressions introduced around MSC4440 bio compatibility work:
gay.fomx.biography_fetched-only statesrcchangesThis branch is intended for integration testing/merge flow that targets
integration.