mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: clear prompt after task creation (#20344)
Fix https://github.com/coder/coder/issues/20255
This commit is contained in:
@@ -145,6 +145,11 @@ export const OnSuccess: Story = {
|
||||
const successMessage = await body.findByText(/task created/i);
|
||||
expect(successMessage).toBeInTheDocument();
|
||||
});
|
||||
|
||||
await step("Clears prompt", async () => {
|
||||
const prompt = await canvas.findByLabelText(/prompt/i);
|
||||
expect(prompt).toHaveValue("");
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -232,6 +232,7 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
|
||||
await createTaskMutation.mutateAsync({
|
||||
prompt,
|
||||
});
|
||||
setPrompt("");
|
||||
} catch (error) {
|
||||
const message = getErrorMessage(error, "Error creating task");
|
||||
const detail = getErrorDetail(error) ?? "Please try again";
|
||||
|
||||
Reference in New Issue
Block a user