feat(chat): initialize current room name in MultiChatDialog.vue

- Added a new property `currentRoomName` to track the name of the currently selected room.
- Updated the initialization logic to reset `currentRoomName` when rooms are loaded and when the chat is disconnected, ensuring accurate room state management.
This commit is contained in:
Torsten Schulz (local)
2026-03-27 15:03:32 +01:00
parent 291e79c41f
commit 84c598bf52

View File

@@ -364,6 +364,7 @@ export default {
connectAttemptTimeout: null, connectAttemptTimeout: null,
joinFallbackTimer: null, joinFallbackTimer: null,
roomSyncInFlight: false, roomSyncInFlight: false,
currentRoomName: '',
// Faster handshake watchdog separate from reconnect interval // Faster handshake watchdog separate from reconnect interval
handshakeWatchdogMs: 2500, handshakeWatchdogMs: 2500,
// Rotate to next candidate if a connection never reaches 'open' // Rotate to next candidate if a connection never reaches 'open'
@@ -756,6 +757,7 @@ export default {
initializeRooms(rooms) { initializeRooms(rooms) {
this.rooms = rooms; this.rooms = rooms;
this.selectedRoom = rooms.length ? rooms[0].id : null; this.selectedRoom = rooms.length ? rooms[0].id : null;
this.currentRoomName = '';
this.autoscroll = true; this.autoscroll = true;
try { this.urlOverride = localStorage.getItem('chatWsOverride') || ''; } catch (_) { this.urlOverride = ''; } try { this.urlOverride = localStorage.getItem('chatWsOverride') || ''; } catch (_) { this.urlOverride = ''; }
this.messages = []; this.messages = [];
@@ -1084,6 +1086,8 @@ export default {
this.chatWs = null; this.chatWs = null;
this.chatConnected = false; this.chatConnected = false;
this.announcedRoomEnter = false; this.announcedRoomEnter = false;
this.currentRoomName = '';
this.roomSyncInFlight = false;
this.usersInRoom = []; this.usersInRoom = [];
this.selectedTargetUser = null; this.selectedTargetUser = null;
}, },
@@ -1179,12 +1183,7 @@ export default {
if (this.joinFallbackTimer) { clearTimeout(this.joinFallbackTimer); this.joinFallbackTimer = null; } if (this.joinFallbackTimer) { clearTimeout(this.joinFallbackTimer); this.joinFallbackTimer = null; }
const actualRoom = msg.to || msg.room || msg.roomName || ''; const actualRoom = msg.to || msg.room || msg.roomName || '';
const desiredRoom = this.resolveInitialRoomName(); const desiredRoom = this.resolveInitialRoomName();
if (actualRoom) { this.currentRoomName = actualRoom || '';
const matchingRoom = this.rooms.find((room) => (room.title || room.name) === actualRoom);
if (matchingRoom) {
this.selectedRoom = matchingRoom.id;
}
}
if ( if (
this.adultOnlyMode this.adultOnlyMode
&& desiredRoom && desiredRoom