From c338c97ea7d69baec97b2b266d4a8821f7ac7cf9 Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Tue, 29 Jul 2025 16:41:28 -0400 Subject: [PATCH] Jon/sky 5741 enable take control via buttons in browser stream component (#3054) --- skyvern-frontend/src/components/BrowserStream.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skyvern-frontend/src/components/BrowserStream.tsx b/skyvern-frontend/src/components/BrowserStream.tsx index 9456c581..617a15ef 100644 --- a/skyvern-frontend/src/components/BrowserStream.tsx +++ b/skyvern-frontend/src/components/BrowserStream.tsx @@ -75,7 +75,7 @@ function BrowserStream({ } else { throw new Error("No browser session, task or workflow provided"); } - const [userIsControlling, setUserIsControlling] = useState(false); + const [userIsControlling, setUserIsControlling] = useState(interactive); const [commandSocket, setCommandSocket] = useState(null); const [vncDisconnectedTrigger, setVncDisconnectedTrigger] = useState(0); const prevVncConnectedRef = useRef(false); @@ -282,13 +282,13 @@ function BrowserStream({ commandSocket.send(JSON.stringify(command)); }; - if (interactive) { + if (interactive || userIsControlling) { sendCommand({ kind: "take-control" }); } else { sendCommand({ kind: "cede-control" }); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [interactive, isCommandConnected]); + }, [interactive, isCommandConnected, userIsControlling]); // Effect to show toast when task or workflow reaches a final state based on hook updates useEffect(() => {