mirror of https://github.com/jetkvm/kvm.git
Remove unused location references and simplify navigation logic
Co-authored-by: adam <adam@buildjet.com>
This commit is contained in:
parent
bde0a086ab
commit
c0ebb8554a
|
@ -5,7 +5,6 @@ import {
|
||||||
Params,
|
Params,
|
||||||
redirect,
|
redirect,
|
||||||
useLoaderData,
|
useLoaderData,
|
||||||
useLocation,
|
|
||||||
useNavigate,
|
useNavigate,
|
||||||
useOutlet,
|
useOutlet,
|
||||||
useParams,
|
useParams,
|
||||||
|
@ -139,7 +138,6 @@ export default function KvmIdRoute() {
|
||||||
const setDiskChannel = useRTCStore(state => state.setDiskChannel);
|
const setDiskChannel = useRTCStore(state => state.setDiskChannel);
|
||||||
const setRpcDataChannel = useRTCStore(state => state.setRpcDataChannel);
|
const setRpcDataChannel = useRTCStore(state => state.setRpcDataChannel);
|
||||||
const setTransceiver = useRTCStore(state => state.setTransceiver);
|
const setTransceiver = useRTCStore(state => state.setTransceiver);
|
||||||
const location = useLocation();
|
|
||||||
|
|
||||||
const isLegacySignalingEnabled = useRef(false);
|
const isLegacySignalingEnabled = useRef(false);
|
||||||
|
|
||||||
|
@ -725,8 +723,8 @@ export default function KvmIdRoute() {
|
||||||
|
|
||||||
const outlet = useOutlet();
|
const outlet = useOutlet();
|
||||||
const onModalClose = useCallback(() => {
|
const onModalClose = useCallback(() => {
|
||||||
if (location.pathname !== "/other-session") navigateTo("/");
|
navigateTo("/");
|
||||||
}, [navigateTo, location.pathname]);
|
}, [navigateTo]);
|
||||||
|
|
||||||
const appVersion = useDeviceStore(state => state.appVersion);
|
const appVersion = useDeviceStore(state => state.appVersion);
|
||||||
const setAppVersion = useDeviceStore(state => state.setAppVersion);
|
const setAppVersion = useDeviceStore(state => state.setAppVersion);
|
||||||
|
@ -761,7 +759,7 @@ export default function KvmIdRoute() {
|
||||||
|
|
||||||
const isDisconnected = peerConnectionState === "disconnected";
|
const isDisconnected = peerConnectionState === "disconnected";
|
||||||
|
|
||||||
const isOtherSession = location.pathname.includes("other-session");
|
const isOtherSession = outlet !== null;
|
||||||
|
|
||||||
if (isOtherSession) return null;
|
if (isOtherSession) return null;
|
||||||
if (peerConnectionState === "connected") return null;
|
if (peerConnectionState === "connected") return null;
|
||||||
|
@ -782,7 +780,7 @@ export default function KvmIdRoute() {
|
||||||
}, [
|
}, [
|
||||||
connectionFailed,
|
connectionFailed,
|
||||||
loadingMessage,
|
loadingMessage,
|
||||||
location.pathname,
|
outlet,
|
||||||
peerConnection,
|
peerConnection,
|
||||||
peerConnectionState,
|
peerConnectionState,
|
||||||
setupPeerConnection,
|
setupPeerConnection,
|
||||||
|
|
Loading…
Reference in New Issue