From f21a1f75ce2dd509f670fba9cfb461db7dd91a2a Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Tue, 24 Mar 2026 21:03:46 +0100 Subject: [PATCH] feat(voice): add cachedUser fallback tier to useVoiceParticipantMeta Inserts a new tier 3 between DM member lookup and identity-only fallback. When the current space's member list doesn't contain the voice participant (user navigated to a different space/instance), the hook now falls back to the cached User object from ParticipantInfo. This preserves avatar, avatarColor, displayName, and homeUserId for federated users in PiP. --- packages/web/src/hooks/useVoiceParticipantMeta.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/web/src/hooks/useVoiceParticipantMeta.ts b/packages/web/src/hooks/useVoiceParticipantMeta.ts index 8ce5d699..62f1b7e4 100644 --- a/packages/web/src/hooks/useVoiceParticipantMeta.ts +++ b/packages/web/src/hooks/useVoiceParticipantMeta.ts @@ -39,8 +39,18 @@ export function useVoiceParticipantMeta(participant: ParticipantInfo) { } } - // 3. Final fallback — parse username from LiveKit identity + // 3. Fallback to cached user from ParticipantInfo (federation carry-forward) + if (participant.cachedUser) { + const { baseName } = parseFederatedUsername(participant.cachedUser.username); + return { + displayName: participant.cachedUser.displayName ?? baseName, + avatar: participant.cachedUser.avatar ?? null, + user: participant.cachedUser, + }; + } + + // 4. Final fallback — parse username from LiveKit identity const { baseName } = parseFederatedUsername(participant.username); return { displayName: baseName, avatar: null, user: null as User | null }; - }, [members, dmChannels, participant.userId, participant.username]); + }, [members, dmChannels, participant.userId, participant.username, participant.cachedUser]); }