fix: suppress expected datachannel closure errors during logout

This commit is contained in:
Alex P 2025-10-23 22:48:32 +03:00
parent f7a5ed6d2e
commit e7bdabb667
1 changed files with 10 additions and 3 deletions

View File

@ -31,9 +31,16 @@ export default function InfoBar() {
useEffect(() => { useEffect(() => {
if (!rpcDataChannel) return; if (!rpcDataChannel) return;
rpcDataChannel.onclose = () => console.log("rpcDataChannel has closed"); rpcDataChannel.onclose = () => {
rpcDataChannel.onerror = (e: Event) => if (rpcDataChannel.readyState === "closed") {
console.error(`Error on DataChannel '${rpcDataChannel.label}': ${e}`); console.debug("rpcDataChannel closed");
}
};
rpcDataChannel.onerror = (e: Event) => {
if (rpcDataChannel.readyState === "open" || rpcDataChannel.readyState === "connecting") {
console.error(`Error on DataChannel '${rpcDataChannel.label}':`, e);
}
};
}, [rpcDataChannel]); }, [rpcDataChannel]);
const { keyboardLedState, usbState } = useHidStore(); const { keyboardLedState, usbState } = useHidStore();