Fix call switching

This commit is contained in:
jim3692 2023-03-22 20:12:29 +02:00
parent 8a5a1f04e1
commit 1264e70408

View file

@ -20,7 +20,7 @@ function JitsiRoom(props) {
eventId: null, eventId: null,
}); });
const [roomName, setRoomName] = useState(''); const [roomName, setRoomName] = useState('');
const [roomId, setRoomId] = useState(''); const [counter, setCounter] = useState(0);
const openerRef = useRef(null); const openerRef = useRef(null);
const mx = initMatrix.matrixClient; const mx = initMatrix.matrixClient;
@ -53,17 +53,12 @@ function JitsiRoom(props) {
}, [mx, roomInfo]); }, [mx, roomInfo]);
useEffect(() => { useEffect(() => {
const topic = roomInfo.roomTimeline?.room.currentState.getStateEvents('m.room.topic')[0]?.getContent().topic if (roomInfo?.roomTimeline) {
if (
topic === TOPIC_JITSI_CALL &&
!jitsiCallId
) {
setJitsiCallId(roomInfo.roomTimeline.roomId); setJitsiCallId(roomInfo.roomTimeline.roomId);
if (roomName === '') { setRoomName(roomInfo.roomTimeline.roomName);
setRoomName(roomInfo.roomTimeline.roomName); setCounter(counter + 1);
}
} }
}, [roomInfo.roomTimeline?.roomName]); }, [roomInfo]);
const { roomTimeline } = roomInfo; const { roomTimeline } = roomInfo;
if (roomTimeline === null) { if (roomTimeline === null) {
@ -91,8 +86,9 @@ function JitsiRoom(props) {
</Button> </Button>
<Button>Return</Button> <Button>Return</Button>
<JitsiMeeting <JitsiMeeting
key={counter}
domain="meet.calyx.net" domain="meet.calyx.net"
roomName={`${roomTimeline.roomName} ${roomTimeline.roomId.replace(':matrix.org', '')}`} roomName={`${roomName} ${roomTimeline.roomId.replace(':matrix.org', '')}`}
configOverwrite={{ configOverwrite={{
disableReactions: true, disableReactions: true,
disablePolls: true, disablePolls: true,