fix leaving

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2025-09-23 12:25:05 +02:00
parent 7777179935
commit 96e96a5e43

View File

@@ -68,7 +68,6 @@ import {
import { GroupCallErrorBoundary } from "./GroupCallErrorBoundary.tsx"; import { GroupCallErrorBoundary } from "./GroupCallErrorBoundary.tsx";
import { import {
useNewMembershipManager as useNewMembershipManagerSetting, useNewMembershipManager as useNewMembershipManagerSetting,
useExperimentalToDeviceTransport as useExperimentalToDeviceTransportSetting,
useSetting, useSetting,
} from "../settings/settings"; } from "../settings/settings";
import { useTypedEventEmitter } from "../useEvents"; import { useTypedEventEmitter } from "../useEvents";
@@ -310,6 +309,7 @@ export const GroupCallView: FC<Props> = ({
useNewMembershipManager, useNewMembershipManager,
]); ]);
// TODO refactor this + "joined" to just one callState
const [left, setLeft] = useState(false); const [left, setLeft] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
@@ -319,6 +319,7 @@ export const GroupCallView: FC<Props> = ({
let playSound: CallEventSounds = "left"; let playSound: CallEventSounds = "left";
if (reason === "timeout" || reason === "decline") playSound = reason; if (reason === "timeout" || reason === "decline") playSound = reason;
setJoined(false);
setLeft(true); setLeft(true);
const audioPromise = leaveSoundContext.current?.playSound(playSound); const audioPromise = leaveSoundContext.current?.playSound(playSound);
// In embedded/widget mode the iFrame will be killed right after the call ended prohibiting the posthog event from getting sent, // In embedded/widget mode the iFrame will be killed right after the call ended prohibiting the posthog event from getting sent,
@@ -354,6 +355,7 @@ export const GroupCallView: FC<Props> = ({
); );
}, },
[ [
setJoined,
leaveSoundContext, leaveSoundContext,
widget, widget,
room.roomId, room.roomId,