mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2025-12-24 08:44:21 +01:00
fix: bug fix that input message gone out though new chat is not sent yet
This commit is contained in:
@@ -8,7 +8,7 @@ import { InlineCompletion } from "./InlineCompletion";
|
||||
|
||||
export interface ChatInputProps {
|
||||
projectId: string;
|
||||
onSubmit: (message: string) => void;
|
||||
onSubmit: (message: string) => Promise<void>;
|
||||
isPending: boolean;
|
||||
error?: Error | null;
|
||||
placeholder: string;
|
||||
@@ -43,9 +43,9 @@ export const ChatInput: FC<ChatInputProps> = ({
|
||||
const fileCompletionRef = useRef<FileCompletionRef>(null);
|
||||
const helpId = useId();
|
||||
|
||||
const handleSubmit = () => {
|
||||
const handleSubmit = async () => {
|
||||
if (!message.trim()) return;
|
||||
onSubmit(message.trim());
|
||||
await onSubmit(message.trim());
|
||||
setMessage("");
|
||||
};
|
||||
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user