mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(mothership): clear chat input after sending a message mid-conversation (#4936)
This commit is contained in:
@@ -1099,9 +1099,10 @@ export const UserInput = forwardRef<UserInputHandle, UserInputProps>(function Us
|
||||
|
||||
// Adopt value changes that bypassed React's change tracking (browser
|
||||
// autofill, password managers, grammar extensions — see facebook/react#2125)
|
||||
// so state never drifts from the DOM. The render rebuilds the overlay and
|
||||
// selection logic resumes on the next event.
|
||||
if (textarea.value !== valueRef.current) {
|
||||
// so state never drifts from the DOM. Skip when state is empty: submit clears
|
||||
// `value` synchronously, but a select/mouseUp can fire while the textarea
|
||||
// still holds the just-sent text, and adopting it would resurrect the message.
|
||||
if (valueRef.current !== '' && textarea.value !== valueRef.current) {
|
||||
adoptDomValue(textarea)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user