fix: key messages by networkId:room to prevent collision across networks

Two networks sharing a room name (e.g. "general") were clobbering each
other's message lists. Now keyed by `${networkId}:${room}` throughout
the web store, MessagePane, and Sidebar DM detection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-29 16:55:16 +02:00
parent dab5387cbd
commit f5fb0862ff
3 changed files with 19 additions and 11 deletions

View File

@@ -42,9 +42,15 @@ export function Sidebar() {
const netCustomRooms = activeNetworkId ? (customRooms[activeNetworkId] ?? []) : []
const rooms = ['general', ...netCustomRooms]
Object.keys(messages).forEach(r => {
if (r.startsWith('dm:') && !rooms.includes(r)) rooms.push(r)
})
if (activeNetworkId) {
const prefix = `${activeNetworkId}:dm:`
Object.keys(messages).forEach(k => {
if (k.startsWith(prefix)) {
const r = k.slice(activeNetworkId.length + 1)
if (!rooms.includes(r)) rooms.push(r)
}
})
}
function submitNewRoom(e: React.FormEvent) {
e.preventDefault()