From cbd1018ea681d7cbe324029ce04d4f74ae59f40a Mon Sep 17 00:00:00 2001 From: Konstantin Khlopkov Date: Wed, 9 Sep 2026 09:52:49 +0000 Subject: [PATCH] fix(dashboard): clear input refs on tab deactivation (#106403) (cherry picked from commit cb6fd96ef0521ed887bb136e12dadf2937053c3c) --- web/src/pages/ChatPage.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/src/pages/ChatPage.tsx b/web/src/pages/ChatPage.tsx index 6bca795bde..a152d9c331 100644 --- a/web/src/pages/ChatPage.tsx +++ b/web/src/pages/ChatPage.tsx @@ -205,6 +205,16 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) { useEffect(() => { setHasActivated((prev) => latchChatActivation(prev, isActive)); }, [isActive]); + + // Clear mobile-input tracking refs when the tab is hidden so stale state + // from a previous /chat visit doesn't cause the mobile-replacement logic + // to misfire on the next activation (#106403: repeated last character). + useEffect(() => { + if (!isActive) { + ptyInputLineRef.current = ""; + mobileReplacementInputUntilRef.current = 0; + } + }, [isActive]); const [searchParams, setSearchParams] = useSearchParams(); // Lazy-init: the missing-token check happens at construction so the effect // body doesn't have to setState (React 19's set-state-in-effect rule).