fix(ui): stop MCP playground tool calls from sending twice (#29821)
This commit is contained in:
parent
b3297fc2ea
commit
21d2c3aa83
@ -151,4 +151,19 @@ describe("ToolTestPanel defaults", () => {
|
||||
expect(screen.getByPlaceholderText("Enter input for this tool")).toBeInTheDocument();
|
||||
expect(screen.queryByText("No parameters required")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the call button as type=button so a click never also triggers native form submission", () => {
|
||||
const schema: InputSchema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
message: { type: "string", description: "Prompt text" },
|
||||
},
|
||||
};
|
||||
|
||||
renderPanel(schema);
|
||||
|
||||
const callButton = screen.getByRole("button", { name: "Call Tool" });
|
||||
expect(callButton.closest("form")).not.toBeNull();
|
||||
expect(callButton).toHaveAttribute("type", "button");
|
||||
});
|
||||
});
|
||||
|
||||
@ -521,6 +521,7 @@ export function ToolTestPanel({
|
||||
|
||||
<div className="pt-3 border-t border-gray-100">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => form.submit()}
|
||||
disabled={isLoading}
|
||||
variant="primary"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user