fix a couple of bugs

This commit is contained in:
Half-Shot
2024-12-16 15:41:49 +00:00
parent 5c0b4d4109
commit 5c580bed14
2 changed files with 6 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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<ActiveCallProps> = (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();