Broadcast profile updates so member lists stay live (no reload needed)

Another user's new display name or avatar didn't show up until you
reloaded -- update_profile/upload_avatar/remove_avatar never told
anyone. Same root cause and fix shape as #26 (room_added): the
frontend's already-fetched member list had no way to hear about a
change, since nothing ever pushed one.

Reuses the existing per-room broadcast channel (not the per-user one
#26 added, since this only matters for rooms the affected user shares
with someone currently looking at them) -- publishes member_updated to
every room the user belongs to; ChatShellPage refetches members when
it arrives for the currently open room.

Verified end-to-end in the browser: one user's room-info member list
updated live when another user changed their display name from a
separate session, no reload.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 11:08:36 -06:00
co-authored by Claude Sonnet 5
parent c84c92446c
commit 1b4d681ad0
5 changed files with 61 additions and 1 deletions
+2 -1
View File
@@ -64,8 +64,9 @@ export function ChatShellPage() {
() =>
socket.subscribe((envelope) => {
if (envelope.type === 'room_added') refreshRooms()
else if (envelope.type === 'member_updated' && envelope.room_id === roomId) refreshMembers()
}),
[socket, refreshRooms],
[socket, refreshRooms, refreshMembers, roomId],
)
useEffect(() => {
+7
View File
@@ -119,6 +119,12 @@ export interface ChatRoomAddedEnvelope {
room_id: string
}
export interface ChatMemberUpdatedEnvelope {
type: 'member_updated'
room_id: string
user_id: string
}
export type ServerEnvelope =
| ChatMessageEnvelope
| ChatMessageUpdateEnvelope
@@ -126,6 +132,7 @@ export type ServerEnvelope =
| ChatJoinedEnvelope
| ChatErrorEnvelope
| ChatRoomAddedEnvelope
| ChatMemberUpdatedEnvelope
export interface AdminUser {
id: string