diff --git a/src/reactions/useReactionsReader.ts b/src/reactions/useReactionsReader.ts index cfffe5ec..0363edf6 100644 --- a/src/reactions/useReactionsReader.ts +++ b/src/reactions/useReactionsReader.ts @@ -245,7 +245,7 @@ export default function useReactionsReader(rtcSession: MatrixRTCSession): { } } else if (event.getType() === EventType.RoomRedaction) { const targetEvent = event.event.redacts; - const targetUser = Object.entries(latestRaisedHands.current).find( + const targetUser = Object.entries(latestRaisedHands.current.value).find( ([_u, r]) => r.reactionEventId === targetEvent, )?.[0]; if (!targetUser) { diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 73e8e1b1..f0e1d449 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -96,6 +96,7 @@ import { useSetting, } from "../settings/settings"; import useReactionsReader from "../reactions/useReactionsReader"; +import { useLatest } from "../useLatest"; const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); @@ -129,17 +130,18 @@ export const ActiveCall: FC = (props) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const reader = useReactionsReader(props.rtcSession); + const reader = useLatest(useReactionsReader(props.rtcSession)); useEffect(() => { if (livekitRoom !== undefined && reader !== undefined) { + console.log("Creating new VM"); const vm = new CallViewModel( props.rtcSession, livekitRoom, props.e2eeSystem, connStateObservable, - reader.raisedHands, - reader.reactions, + reader.current.raisedHands, + reader.current.reactions, ); setVm(vm); return (): void => vm.destroy();