Skip to content

Commit bc1aeb5

Browse files
fix(user-input): clear mention state on submit
Programmatic plusMenuRef.close() sets the dropdown's internal open=false but Radix doesn't fire onOpenChange for controlled changes, so handlePlusMenuClose never ran and mentionRangeRef stayed truthy after submitting a message with an active @mention. That caused the keydown handler to keep intercepting ArrowUp/ArrowDown/Tab post-submit, breaking the "edit last queued message" ArrowUp shortcut until the user typed again. Clear mentionRangeRef and mentionQuery inline alongside the close() call. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 97844db commit bc1aeb5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/home/components/user-input

apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,11 @@ export const UserInput = forwardRef<UserInputHandle, UserInputProps>(function Us
470470
currentFiles.clearAttachedFiles()
471471
prevSelectedContextsRef.current = []
472472
currentContext.clearContexts()
473+
// Programmatic close() bypasses Radix's onOpenChange, so handlePlusMenuClose won't
474+
// fire — clear mention state inline so ArrowUp etc. aren't intercepted post-submit.
473475
plusMenuRef.current?.close()
476+
mentionRangeRef.current = null
477+
setMentionQuery(null)
474478

475479
if (textareaRef.current) {
476480
textareaRef.current.style.height = 'auto'

0 commit comments

Comments
 (0)