Skip to content

Commit 3bf7104

Browse files
authored
fix(mothership): clear chat input after sending a message mid-conversation (#4936)
1 parent 209501e commit 3bf7104

1 file changed

Lines changed: 4 additions & 3 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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,10 @@ export const UserInput = forwardRef<UserInputHandle, UserInputProps>(function Us
10991099

11001100
// Adopt value changes that bypassed React's change tracking (browser
11011101
// autofill, password managers, grammar extensions — see facebook/react#2125)
1102-
// so state never drifts from the DOM. The render rebuilds the overlay and
1103-
// selection logic resumes on the next event.
1104-
if (textarea.value !== valueRef.current) {
1102+
// so state never drifts from the DOM. Skip when state is empty: submit clears
1103+
// `value` synchronously, but a select/mouseUp can fire while the textarea
1104+
// still holds the just-sent text, and adopting it would resurrect the message.
1105+
if (valueRef.current !== '' && textarea.value !== valueRef.current) {
11051106
adoptDomValue(textarea)
11061107
return
11071108
}

0 commit comments

Comments
 (0)