review + found unnecassary code

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2023-11-28 18:34:06 +01:00
parent fcddac550b
commit 5362b024c9

View File

@@ -107,15 +107,12 @@ export const ActiveCall: FC<ActiveCallProps> = (props) => {
props.e2eeConfig,
);
const cleanup = useCallback(() => {
if (connState === ConnectionState.Connected) {
livekitRoom?.disconnect();
}
}, [livekitRoom, connState]);
useEffect(() => {
return cleanup;
}, [cleanup, livekitRoom]);
return () => {
livekitRoom?.disconnect();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
if (!livekitRoom) return null;
@@ -207,14 +204,6 @@ export const InCallView: FC<InCallViewProps> = ({
(muted) => muteStates.audio.setEnabled?.(!muted),
);
const onLeavePress = useCallback(() => {
// Disconnect from the room. We don't do this in onLeave because that's
// also called on an unintentional disconnect. Plus we don't have the
// livekit room in onLeave anyway.
livekitRoom.disconnect();
onLeave();
}, [livekitRoom, onLeave]);
useEffect(() => {
widget?.api.transport.send(
layout === "grid"
@@ -392,11 +381,7 @@ export const InCallView: FC<InCallViewProps> = ({
}
buttons.push(
<HangupButton
key="6"
onPress={onLeavePress}
data-testid="incall_leave"
/>,
<HangupButton key="6" onPress={onLeave} data-testid="incall_leave" />,
);
footer = (
<div