fix: optimistic voice state so user appears in sidebar immediately
Previously, the voice channel sidebar only showed users after a server round-trip (voice_state_update broadcast). After a deploy/reconnect, this left the user invisible in the sidebar despite being connected. Now joinVoiceChannel, leaveVoice, and the WS ready handler all optimistically update voiceUsers for the local user immediately.
This commit is contained in:
@@ -172,6 +172,9 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
||||
console.log('[WebSocket] Re-syncing voice status on reconnect:', { currentVoiceChannelId, origin, curMuted, curDeafened, curCamera, curScreen });
|
||||
wsSend({ type: 'voice_join', channelId: currentVoiceChannelId }, origin);
|
||||
wsSend({ type: 'voice_status', isMuted: curMuted, isDeafened: curDeafened, isCameraOn: curCamera, isScreenSharing: curScreen }, origin);
|
||||
// Optimistic: immediately show self in voice channel sidebar
|
||||
const myId = isHome ? event.user.id : useAuthStore.getState().user?.id;
|
||||
if (myId) addVoiceUser(currentVoiceChannelId, myId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user