Skip to content

Commit 432fbca

Browse files
authored
Merge pull request #2274 from lincheoll/2272--fix-ime-multiple-messages
Fix: IME causes multiple messages on Enter (Fixes #2272)
2 parents 58e9f7c + 8f49482 commit 432fbca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

client/src/components/chat.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ export default function Page({ agentId }: { agentId: UUID }) {
6161

6262
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
6363
if (e.key === "Enter" && !e.shiftKey) {
64+
e.preventDefault();
65+
if (e.nativeEvent.isComposing) return;
6466
handleSendMessage(e as unknown as React.FormEvent<HTMLFormElement>);
6567
}
6668
};
6769

70+
6871
const handleSendMessage = (e: React.FormEvent<HTMLFormElement>) => {
6972
e.preventDefault();
7073
if (!input) return;

0 commit comments

Comments
 (0)