Private
Public Access
Fix DM presence indicator never updating live (#63)
The sidebar shows every DM's online/offline dot at once, but the only existing signal for a presence change (member_updated) is broadcast to a room's own channel, which Presence only delivers to a connection that currently has that specific room joined -- never true for a DM sitting unopened in the sidebar. Add a dedicated per-user broadcast (dm_presence_update) sent to each of a user's DM partners on their own per-user channel whenever their global online/offline state changes, so the sidebar dot updates without needing that DM to be the open room. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,14 @@ export function ChatShellPage() {
|
||||
: r,
|
||||
),
|
||||
)
|
||||
} else if (envelope.type === 'dm_presence_update') {
|
||||
setRooms((prev) =>
|
||||
prev.map((r) =>
|
||||
r.dm_partner && r.dm_partner.user_id === envelope.user_id
|
||||
? { ...r, dm_partner: { ...r.dm_partner, status: envelope.status } }
|
||||
: r,
|
||||
),
|
||||
)
|
||||
}
|
||||
}),
|
||||
[socket, refreshRooms, refreshMembers, roomId],
|
||||
|
||||
Reference in New Issue
Block a user