Skip to content

Commit 3d13643

Browse files
committed
fix: Properly handle USB serial disconnects.
* Also catch notification listening, so we can clear the connection when Web Serial raises an error when the port goes away.
1 parent 2aa5ea5 commit 3d13643

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ async function connect(transport: RpcTransport, setConn: Dispatch<RpcConnection
7575

7676
listen_for_notifications(rpc_conn.notification_readable).then(() => {
7777
setConn(null);
78+
}).catch((_e) => {
79+
setConn(null);
7880
});
7981

8082
setConn(rpc_conn);

0 commit comments

Comments
 (0)