From d23a6f6b755dd5569634eca5362daf807db3a0e3 Mon Sep 17 00:00:00 2001 From: Aditya Chaudhary <30+useradityaa@noreply.coracle.social> Date: Fri, 14 Aug 2026 15:46:25 +0000 Subject: [PATCH] Fix leave button requiring two clicks when screen sharing (#367) Co-authored-by: Aditya Chaudhary <30+useradityaa@noreply.coracle.social> --- src/app/call.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/call.ts b/src/app/call.ts index 3bbaae07..925587a8 100644 --- a/src/app/call.ts +++ b/src/app/call.ts @@ -264,7 +264,12 @@ export const leaveVoiceRoom = async () => { // Only reset shared UI state if this session is still current. A slow leave // that was superseded by a new join (bounded by a timeout in joinVoiceRoom) // must not clobber the freshly-joined session when it finally completes. - if (get(currentCallSession) === session) { + // + // Compare the LiveKit room rather than the session object: turning off the + // screen share above emits LocalTrackUnpublished, whose handler replaces the + // store value with a new object for the same call. An identity check would + // fail there and leave the UI stuck in a connected state. + if (get(currentCallSession)?.livekit === session.livekit) { callState.set(CallState.Disconnected) callMicMuted.set(true) currentCallSession.set(undefined)