Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix(workflow-editor): reflow copilot composer textarea on width change (SKY-10791) (#6497)
Andrew Neilsonec798af203d7
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsxindex e863e9c9f..7932ea3f2 100644--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx@@ -451,7 +451,7 @@ export function WorkflowCopilotChat({});const credentialGetter = useCredentialGetter();const { workflowRunId, workflowPermanentId } = useParams();- const textareaRef = useRef<HTMLTextAreaElement>(null);+ const textareaRef = useRef<HTMLTextAreaElement | null>(null);const { getSaveData } = useWorkflowHasChangesStore();const hasInitializedPosition = useRef(false);const hasAutoSentRef = useRef(false);@@ -515,6 +515,27 @@ export function WorkflowCopilotChat({adjustTextareaHeight();}, [adjustTextareaHeight, inputValue]);+ const resizeObserverRef = useRef<ResizeObserver | null>(null);+ // Bind the observer when the textarea mounts (it can mount late); the width-only guard avoids a resize loop.+ const setTextareaRef = useCallback(+ (node: HTMLTextAreaElement | null) => {+ textareaRef.current = node;+ resizeObserverRef.current?.disconnect();+ resizeObserverRef.current = null;+ if (!node || typeof ResizeObserver === "undefined") return;+ let lastWidth = node.clientWidth;+ const observer = new ResizeObserver(() => {+ if (node.clientWidth !== lastWidth) {+ lastWidth = node.clientWidth;+ adjustTextareaHeight();+ }+ });+ observer.observe(node);+ resizeObserverRef.current = observer;+ },+ [adjustTextareaHeight],+ );+const {isSupported: isSpeechSupported,isListening: isSpeechListening,@@ -1840,7 +1861,7 @@ export function WorkflowCopilotChat({className="h-10 w-10 rounded-lg"/><textarea- ref={textareaRef}+ ref={setTextareaRef}placeholder={queuedPrompt? "Prompt queued..."