feat: real-time user profile updates and propagate avatarColor to all Avatar callsites
Broadcast user_updated events over WebSocket when profile fields change, updating members, DM participants, friends, and cached messages in real time. Widen useVoiceParticipantMeta to return the full user object and add a standalone avatarColor prop to Avatar so all ~16 callsites now resolve the user's chosen gradient color instead of falling back to hash-based colors.
This commit is contained in:
@@ -310,6 +310,21 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user_updated': {
|
||||
if (!isHome) normalizeUserAssets(event.user, origin);
|
||||
useSpaceStore.getState().updateUserEverywhere(event.user);
|
||||
useSocialStore.getState().updateFriendProfile(event.user);
|
||||
useChatStore.getState().updateUserInMessages(event.user);
|
||||
// If this is the current user (other tab changed profile), update authStore
|
||||
const myId = isHome
|
||||
? useAuthStore.getState().user?.id
|
||||
: getMyUserIdForOrigin(origin);
|
||||
if (event.user.id === myId && isHome) {
|
||||
setUser(event.user);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'voice_state_update':
|
||||
if (event.action === 'join') {
|
||||
addVoiceUser(event.channelId, event.userId);
|
||||
|
||||
Reference in New Issue
Block a user