From f52b184d5fc994075a553a16ed11ded2ed343b29 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 15 Jul 2026 09:32:59 +0200 Subject: [PATCH] fix(frontend): buffer suggestion card edits locally to prevent render loop --- .../chat/ProjectUpdateSuggestionCard.tsx | 61 +++++++++++++------ 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/echo/frontend/src/components/chat/ProjectUpdateSuggestionCard.tsx b/echo/frontend/src/components/chat/ProjectUpdateSuggestionCard.tsx index 97f8e953..c531d81d 100644 --- a/echo/frontend/src/components/chat/ProjectUpdateSuggestionCard.tsx +++ b/echo/frontend/src/components/chat/ProjectUpdateSuggestionCard.tsx @@ -112,8 +112,33 @@ const ValueText = ({ ); }; -/** - * Renders an agent-proposed settings change for the host to review. + /** + * A local input component that prevents keystroke-by-keystroke re-renders + * of the entire outer card and chat list. It buffers the value locally in state + * and only flushes it to the parent state on blur or unmount. + */ + const BufferedTextarea = ({ + initialValue, + onFlush, + ...props + }: Omit, "value" | "onChange"> & { + initialValue: string; + onFlush: (val: string) => void; + }) => { + const [localVal, setLocalVal] = useState(initialValue); + + return ( +