diff --git a/package.json b/package.json index d0aa5ea6..e082278c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "0.25.0", + "version": "0.25.1", "private": true, "scripts": { "dev": "react-scripts start", diff --git a/src/contexts/RobotContext.tsx b/src/contexts/RobotContext.tsx index cc224d1a..bdb1fb54 100644 --- a/src/contexts/RobotContext.tsx +++ b/src/contexts/RobotContext.tsx @@ -258,19 +258,26 @@ export default ({ children }: any) => { : null; vdiClient?.addEventListener("open", () => { - isVDIConnected === null && setIsVDIConnected(true); + if (isVDIConnected === null) { + setIsVDIConnected(true); + vdiClient?.close(); + } }); vdiClient?.addEventListener("error", () => { - isVDIConnected === null && setIsVDIConnected(false); + if (isVDIConnected === null) { + setIsVDIConnected(false); + vdiClient?.close(); + } }); vdiClient?.addEventListener("close", () => { - isVDIConnected === null && setIsVDIConnected(false); + if (isVDIConnected === null) { + setIsVDIConnected(false); + vdiClient?.close(); + } }); - typeof isVDIConnected === "boolean" && vdiClient?.close(); - return () => { vdiClient?.close(); };