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') {
|
if (e.key === 'Enter') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (text.trim() === '') {
|
if (textRef.current.trim() === '') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setRoute('chat')
|
setRoute('chat')
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const InputBar: FC<InputBarProps> = ({ text, model, placeholder, handleKeyDown,
|
|||||||
bordered={false}
|
bordered={false}
|
||||||
autoFocus
|
autoFocus
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
onChange={(e) => setText(e.target.value.trim())}
|
onChange={(e) => setText(e.target.value)}
|
||||||
disabled={generating}
|
disabled={generating}
|
||||||
/>
|
/>
|
||||||
</InputWrapper>
|
</InputWrapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user