From 583765b88300f7ac022015f8d5b021cfeaca7e35 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Feb 2026 00:34:57 +0000 Subject: [PATCH] fix: move setComposerCursor outside rAF to prevent stale trigger flash setComposerCursor was deferred inside requestAnimationFrame while setPrompt was called synchronously. This caused an intermediate render where composerTrigger was computed with the new prompt text but the old cursor position, briefly reopening the command menu with incorrect results. Moving setComposerCursor alongside setPrompt ensures both states update in the same render cycle. --- apps/web/src/components/ChatView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 3918fdac40..c50ef32168 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1246,12 +1246,12 @@ export default function ChatView() { const next = replaceTextRange(promptRef.current, rangeStart, rangeEnd, replacement); promptRef.current = next.text; setPrompt(next.text); + setComposerCursor(next.cursor); window.requestAnimationFrame(() => { const textarea = textareaRef.current; if (!textarea) return; textarea.focus(); textarea.setSelectionRange(next.cursor, next.cursor); - setComposerCursor(next.cursor); }); }, [],