From 108eb60b4aebb0b6812ba4073c4e76161c0bb132 Mon Sep 17 00:00:00 2001 From: Gigiaj Date: Sun, 25 May 2025 21:29:53 -0500 Subject: [PATCH] Seems to avoid almost all invalid states (hang up while viewing another lobby and hitting join seems to black screen, sets the active call as the previous active room id, but does join the viewed room correctly) --- src/app/pages/client/call/CallProvider.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/pages/client/call/CallProvider.tsx b/src/app/pages/client/call/CallProvider.tsx index 99cf81e3..19bf71bf 100644 --- a/src/app/pages/client/call/CallProvider.tsx +++ b/src/app/pages/client/call/CallProvider.tsx @@ -207,15 +207,14 @@ export function CallProvider({ children }: CallProviderProps) { (nextRoom: string) => { setIsCallActive(false); if (typeof nextRoom !== 'string') { - if (viewedCallRoomId === activeCallRoomId) { + if (activeCallRoomId && viewedCallRoomId === activeCallRoomId) { setIsPrimaryIframe(!isPrimaryIframe); - } else { - setViewedCallRoomId(activeCallRoomId); } + logger.error(`${activeCallRoomId} ${viewedCallRoomId}`); + setViewedCallRoomId(activeCallRoomId); } else if (viewedCallRoomId !== null) { setIsPrimaryIframe(!isPrimaryIframe); - setViewedCallRoomId(null); - } + } else if (activeCallRoomId) setViewedCallRoomId(nextRoom); setActiveClientWidgetApi(null, null, null); setActiveCallRoomId(null); @@ -323,6 +322,8 @@ export function CallProvider({ children }: CallProviderProps) { activeClientWidgetApi?.removeAllListeners(); activeClientWidgetApi?.transport.send(WIDGET_HANGUP_ACTION, {}).then(() => { setViewedAsActive(); + setViewedCallRoomIdState(null); + setViewedClientWidgetApi(null, null, null); }); } else { setIsCallActive(true);