From ca31602933ea8e3b2e33c4e18f894d6a6ec35e60 Mon Sep 17 00:00:00 2001 From: d-kimsuon Date: Sun, 7 Sep 2025 17:12:11 +0900 Subject: [PATCH] fix: bug fix that input message gone out though new chat is not sent yet --- .../projects/[projectId]/components/chatForm/ChatInput.tsx | 6 +++--- src/app/projects/[projectId]/components/newChat/NewChat.tsx | 4 ++-- .../[sessionId]/components/resumeChat/ResumeChat.tsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/projects/[projectId]/components/chatForm/ChatInput.tsx b/src/app/projects/[projectId]/components/chatForm/ChatInput.tsx index 8d66b18..e4fe8c9 100644 --- a/src/app/projects/[projectId]/components/chatForm/ChatInput.tsx +++ b/src/app/projects/[projectId]/components/chatForm/ChatInput.tsx @@ -8,7 +8,7 @@ import { InlineCompletion } from "./InlineCompletion"; export interface ChatInputProps { projectId: string; - onSubmit: (message: string) => void; + onSubmit: (message: string) => Promise; isPending: boolean; error?: Error | null; placeholder: string; @@ -43,9 +43,9 @@ export const ChatInput: FC = ({ const fileCompletionRef = useRef(null); const helpId = useId(); - const handleSubmit = () => { + const handleSubmit = async () => { if (!message.trim()) return; - onSubmit(message.trim()); + await onSubmit(message.trim()); setMessage(""); }; diff --git a/src/app/projects/[projectId]/components/newChat/NewChat.tsx b/src/app/projects/[projectId]/components/newChat/NewChat.tsx index b39b24b..f72939f 100644 --- a/src/app/projects/[projectId]/components/newChat/NewChat.tsx +++ b/src/app/projects/[projectId]/components/newChat/NewChat.tsx @@ -7,8 +7,8 @@ export const NewChat: FC<{ }> = ({ projectId, onSuccess }) => { const startNewChat = useNewChatMutation(projectId, onSuccess); - const handleSubmit = (message: string) => { - startNewChat.mutate({ message }); + const handleSubmit = async (message: string) => { + await startNewChat.mutateAsync({ message }); }; return ( diff --git a/src/app/projects/[projectId]/sessions/[sessionId]/components/resumeChat/ResumeChat.tsx b/src/app/projects/[projectId]/sessions/[sessionId]/components/resumeChat/ResumeChat.tsx index a69ac37..759ee3c 100644 --- a/src/app/projects/[projectId]/sessions/[sessionId]/components/resumeChat/ResumeChat.tsx +++ b/src/app/projects/[projectId]/sessions/[sessionId]/components/resumeChat/ResumeChat.tsx @@ -12,8 +12,8 @@ export const ResumeChat: FC<{ }> = ({ projectId, sessionId, isPausedTask, isRunningTask }) => { const resumeChat = useResumeChatMutation(projectId, sessionId); - const handleSubmit = (message: string) => { - resumeChat.mutate({ message }); + const handleSubmit = async (message: string) => { + await resumeChat.mutateAsync({ message }); }; const getButtonText = () => {