fix: make dropdown not repeat values on update, update mcp component (#7779)

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
Lucas Oliveira 2025-04-24 13:01:43 -03:00 committed by GitHub
commit 3b660c26a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 15 additions and 8 deletions

View file

@ -203,6 +203,10 @@ class MCPToolsComponent(Component):
return processed_headers
return {}
def _is_valid_key_value_item(self, item: Any) -> bool:
"""Check if an item is a valid key-value dictionary."""
return isinstance(item, dict) and "key" in item and "value" in item
async def _validate_schema_inputs(self, tool_obj) -> list[InputTypes]:
"""Validate and process schema inputs for a tool."""
try:
@ -234,6 +238,7 @@ class MCPToolsComponent(Component):
try:
if field_name == "mode":
self.remove_non_default_keys(build_config)
build_config["tool"]["options"] = []
if field_value == "Stdio":
build_config["command"]["show"] = True
build_config["env"]["show"] = True

View file

@ -68,7 +68,7 @@ export default function Dropdown({
const [customValue, setCustomValue] = useState("");
const [filteredOptions, setFilteredOptions] = useState(() => {
// Include the current value in filteredOptions if it's a custom value not in validOptions
if (value && !validOptions.includes(value)) {
if (value && !validOptions.includes(value) && combobox) {
return [...validOptions, value];
}
return validOptions;
@ -221,12 +221,14 @@ export default function Dropdown({
);
// If there are custom values, preserve them when resetting filtered options
if (customValuesInFiltered.length > 0) {
if (customValuesInFiltered.length > 0 && combobox) {
setFilteredOptions([...validOptions, ...customValuesInFiltered]);
} else {
setFilteredOptions(validOptions);
}
setCustomValue("");
}
if (!combobox && value && !validOptions.includes(value)) {
onSelect("", undefined, true);
}
}, [open, validOptions]);

View file

@ -5,7 +5,7 @@ test.describe("group node test", () => {
/// <reference lib="dom"/>
test(
"group and ungroup updating values",
{ tag: ["@release", "@workspace"] },
{ tag: ["@release", "@workspace", "@components"] },
async ({ page }) => {
await awaitBootstrapTest(page);

View file

@ -2,7 +2,7 @@ import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test(
"user should be able to edit flow name by clicking on the header or on the main page",
{ tag: ["@release"] },
{ tag: ["@release", "@workspace"] },
async ({ page }) => {
const randomName = Math.random().toString(36).substring(2, 15);
const randomName2 = Math.random().toString(36).substring(2, 15);

View file

@ -2,7 +2,7 @@ import { expect, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test(
"user should be able to edit tools",
{ tag: ["@release"] },
{ tag: ["@release", "@components"] },
async ({ page }) => {
await awaitBootstrapTest(page);

View file

@ -4,7 +4,7 @@ import { zoomOut } from "../../utils/zoom-out";
test(
"user must be able to change mode of MCP server without any issues",
{ tag: ["@release", "@workspace"] },
{ tag: ["@release", "@workspace", "@components"] },
async ({ page }) => {
await awaitBootstrapTest(page);

View file

@ -4,7 +4,7 @@ import { zoomOut } from "../../utils/zoom-out";
test(
"User should be able to use components as tool",
{ tag: ["@release"] },
{ tag: ["@release", "@components"] },
async ({ page }) => {
await awaitBootstrapTest(page);
await page.getByTestId("blank-flow").click();