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(() => {
if (!rpcDataChannel) return;
rpcDataChannel.onclose = () => console.log("rpcDataChannel has closed");
rpcDataChannel.onerror = (e: Event) =>
console.error(`Error on DataChannel '${rpcDataChannel.label}': ${e}`);
rpcDataChannel.onclose = () => {
if (rpcDataChannel.readyState === "closed") {
console.debug("rpcDataChannel closed");
}
};
rpcDataChannel.onerror = (e: Event) => {
if (rpcDataChannel.readyState === "open" || rpcDataChannel.readyState === "connecting") {
console.error(`Error on DataChannel '${rpcDataChannel.label}':`, e);
}
};
}, [rpcDataChannel]);
const { keyboardLedState, usbState } = useHidStore();