Seems to sort out the hangup status button bug the occurred after joining a call via lobby

This commit is contained in:
Gigiaj 2025-05-23 16:34:44 -05:00
parent 872e9a257f
commit 0b6009aaee

View file

@ -123,14 +123,6 @@ export function CallProvider({ children }: CallProviderProps) {
[setViewedCallRoomIdState] [setViewedCallRoomIdState]
); );
const hangUp = useCallback(() => {
logger.debug(`CallContext: Hang up called.`);
activeClientWidgetApi?.transport.send(`${WIDGET_HANGUP_ACTION}`, {});
viewedClientWidgetApi?.transport.send(`${WIDGET_HANGUP_ACTION}`, {});
setActiveCallRoomIdState(null);
setIsCallActive(false);
}, [activeClientWidgetApi?.transport, viewedClientWidgetApi?.transport]);
const setActiveClientWidgetApi = useCallback( const setActiveClientWidgetApi = useCallback(
(clientWidgetApi: ClientWidgetApi | null, roomId: string | null) => { (clientWidgetApi: ClientWidgetApi | null, roomId: string | null) => {
setActiveClientWidgetApiState(clientWidgetApi); setActiveClientWidgetApiState(clientWidgetApi);
@ -186,6 +178,14 @@ export function CallProvider({ children }: CallProviderProps) {
[viewedClientWidgetApi, viewedClientWidgetApiRoomId, setViewedClientWidgetApi] [viewedClientWidgetApi, viewedClientWidgetApiRoomId, setViewedClientWidgetApi]
); );
const hangUp = useCallback(() => {
logger.debug(`CallContext: Hang up called.`);
activeClientWidgetApi?.transport.send(`${WIDGET_HANGUP_ACTION}`, {});
setActiveClientWidgetApi(null, null);
setViewedCallRoomId(activeCallRoomId);
setIsCallActive(false);
}, [activeCallRoomId, activeClientWidgetApi?.transport, setActiveClientWidgetApi, setViewedCallRoomId]);
useEffect(() => { useEffect(() => {
if (!activeCallRoomId && !viewedCallRoomId) { if (!activeCallRoomId && !viewedCallRoomId) {
return; return;