fix: prevent unnecessary route changes and trim input field on change
This commit is contained in:
parent
725f81c165
commit
b01aca9066
@ -59,7 +59,7 @@ const HomeWindow: FC = () => {
|
||||
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault()
|
||||
if (text.trim() === '') {
|
||||
if (textRef.current.trim() === '') {
|
||||
return
|
||||
}
|
||||
setRoute('chat')
|
||||
|
||||
@ -24,7 +24,7 @@ const InputBar: FC<InputBarProps> = ({ text, model, placeholder, handleKeyDown,
|
||||
bordered={false}
|
||||
autoFocus
|
||||
onKeyDown={handleKeyDown}
|
||||
onChange={(e) => setText(e.target.value.trim())}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
disabled={generating}
|
||||
/>
|
||||
</InputWrapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user