From b6a4f76e43f12f1fab897036fd9ff377e780c8d6 Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Thu, 4 Dec 2025 13:06:46 +0000 Subject: [PATCH] Both TypeScript and ESLint pass. The fix is complete. (#1427) **Summary**: Added a single guard condition to the `useEffect` that syncs `localMessage` from scratch data. When `isTextareaFocused` is true, the effect now returns early, preventing the cursor jump issue caused by the WebSocket sync overwriting the local message while the user is actively typing. --- frontend/src/components/tasks/TaskFollowUpSection.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/tasks/TaskFollowUpSection.tsx b/frontend/src/components/tasks/TaskFollowUpSection.tsx index 762d4b8f..a8deac8c 100644 --- a/frontend/src/components/tasks/TaskFollowUpSection.tsx +++ b/frontend/src/components/tasks/TaskFollowUpSection.tsx @@ -214,11 +214,12 @@ export function TaskFollowUpSection({ 500 ); - // Sync local message from scratch when it loads + // Sync local message from scratch when it loads (but not while user is typing) useEffect(() => { if (isScratchLoading) return; + if (isTextareaFocused) return; // Don't overwrite while user is typing setLocalMessage(scratchData?.message ?? ''); - }, [isScratchLoading, scratchData?.message]); + }, [isScratchLoading, scratchData?.message, isTextareaFocused]); // During retry, follow-up box is greyed/disabled (not hidden) // Use RetryUi context so optimistic retry immediately disables this box