Skip to content

fix: recover profile and avatar loading#566

Merged
7w1 merged 6 commits intoSableClient:devfrom
Just-Insane:fix/profile-avatar-loading
Mar 28, 2026
Merged

fix: recover profile and avatar loading#566
7w1 merged 6 commits intoSableClient:devfrom
Just-Insane:fix/profile-avatar-loading

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented Mar 28, 2026

Description

Fixes profile and avatar loading regressions introduced around the MSC4440 bio compatibility work.

This PR addresses two related problems:

  • Own profile data could disappear when useUserProfile encountered gay.fomx.biography in an unexpected shape or when the field was missing entirely.
  • Avatar components could get stuck in fallback mode after a transient image load failure, causing the account avatar and other avatars to disappear until a full reload.

The fix does three things:

  • parses gay.fomx.biography defensively with optional access instead of assuming m.text[0].body always exists
  • retries profile fetches when the cache was previously poisoned into an _fetched-only state after normalization failed
  • resets avatar error state when the image src changes so transient media/auth failures can recover on later renders

This was verified against the broken Account settings / account switcher behavior where avatar, banner, bio, status, and pronouns could appear missing.

Fixup of #559

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (GitHub Copilot)

useUserProfile.ts: Hardened MSC4440 bio parsing so missing or malformed gay.fomx.biography data does not throw during normalization, and allowed refetching when the profile cache only contains _fetched: true from a prior failed normalization.

UserAvatar.tsx and RoomAvatar.tsx: Reset local image error state when src changes so a temporary image load failure does not permanently lock the component into fallback rendering.

This comment was marked as spam.

Just-Insane and others added 2 commits March 28, 2026 01:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dozro dozro added the internal label Mar 28, 2026
@Just-Insane Just-Insane force-pushed the fix/profile-avatar-loading branch from bf89a08 to 724b45f Compare March 28, 2026 15:09
@7w1 7w1 added this pull request to the merge queue Mar 28, 2026
Merged via the queue into SableClient:dev with commit 14b2e34 Mar 28, 2026
9 checks passed
@Just-Insane Just-Insane deleted the fix/profile-avatar-loading branch March 28, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants