From 1264e70408f2e736ba57ef231ef12c4cae35af23 Mon Sep 17 00:00:00 2001 From: jim3692 Date: Wed, 22 Mar 2023 20:12:29 +0200 Subject: [PATCH] Fix call switching --- src/app/organisms/room/JitsiRoom.jsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/app/organisms/room/JitsiRoom.jsx b/src/app/organisms/room/JitsiRoom.jsx index 1caf9318..7d742d36 100644 --- a/src/app/organisms/room/JitsiRoom.jsx +++ b/src/app/organisms/room/JitsiRoom.jsx @@ -20,7 +20,7 @@ function JitsiRoom(props) { eventId: null, }); const [roomName, setRoomName] = useState(''); - const [roomId, setRoomId] = useState(''); + const [counter, setCounter] = useState(0); const openerRef = useRef(null); const mx = initMatrix.matrixClient; @@ -53,17 +53,12 @@ function JitsiRoom(props) { }, [mx, roomInfo]); useEffect(() => { - const topic = roomInfo.roomTimeline?.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic - if ( - topic === TOPIC_JITSI_CALL && - !jitsiCallId - ) { + if (roomInfo?.roomTimeline) { setJitsiCallId(roomInfo.roomTimeline.roomId); - if (roomName === '') { - setRoomName(roomInfo.roomTimeline.roomName); - } + setRoomName(roomInfo.roomTimeline.roomName); + setCounter(counter + 1); } - }, [roomInfo.roomTimeline?.roomName]); + }, [roomInfo]); const { roomTimeline } = roomInfo; if (roomTimeline === null) { @@ -91,8 +86,9 @@ function JitsiRoom(props) {