Skip to content

Commit 09a41f3

Browse files
author
Bruno Quaresma
authored
fix: clear prompt after task creation (#20344)
Fix #20255
1 parent 16a863e commit 09a41f3

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎site/src/modules/tasks/TaskPrompt/TaskPrompt.stories.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ export const OnSuccess: Story = {
145145
const successMessage = await body.findByText(/task created/i);
146146
expect(successMessage).toBeInTheDocument();
147147
});
148+
149+
await step("Clears prompt", async () => {
150+
const prompt = await canvas.findByLabelText(/prompt/i);
151+
expect(prompt).toHaveValue("");
152+
});
148153
},
149154
};
150155

‎site/src/modules/tasks/TaskPrompt/TaskPrompt.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ const CreateTaskForm: FC<CreateTaskFormProps> = ({ templates, onSuccess }) => {
232232
await createTaskMutation.mutateAsync({
233233
prompt,
234234
});
235+
setPrompt("");
235236
} catch (error) {
236237
const message = getErrorMessage(error, "Error creating task");
237238
const detail = getErrorDetail(error) ?? "Please try again";

0 commit comments

Comments
 (0)