fix: suppress redundant reconnect sounds and broadcasts during active voice

This commit is contained in:
Jannis Braun
2026-02-20 03:07:53 +01:00
parent 9fed8214c7
commit a8be2dd5da
2 changed files with 22 additions and 2 deletions
+17
View File
@@ -384,6 +384,23 @@ function handleVoiceJoin(event: Record<string, unknown>, userId: string): void {
return;
}
// If the user is already in this exact channel (e.g. WS reconnect re-registration),
// skip the leave+join broadcast to avoid visual flicker for other users.
const currentChannel = connectionManager.getUserVoiceChannel(userId);
if (currentChannel === channelId) {
const status = connectionManager.getVoiceUserStatus(userId);
if (status) {
connectionManager.sendToServer(serverId, {
type: 'voice_status_update',
userId,
channelId,
isMuted: status.isMuted,
isDeafened: status.isDeafened,
});
}
return;
}
// Leave any current voice channel
const previousChannel = connectionManager.leaveAllVoice(userId);
if (previousChannel) {