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