From 417af07c67c0a668c486f53fbddda104c4c35413 Mon Sep 17 00:00:00 2001 From: john Date: Tue, 24 Mar 2026 09:52:48 +0800 Subject: [PATCH] fix: prevent premature URL validation error when configuring streamable MCP (#340) Fix bitwise OR to logical OR in transport check and defer inline validation errors until the user has entered a value, so the URL field no longer turns red before any input. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/views/Overlay/Tools/Popup/CustomEdit.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/Overlay/Tools/Popup/CustomEdit.tsx b/src/views/Overlay/Tools/Popup/CustomEdit.tsx index 72935651..a28b2176 100644 --- a/src/views/Overlay/Tools/Popup/CustomEdit.tsx +++ b/src/views/Overlay/Tools/Popup/CustomEdit.tsx @@ -800,7 +800,7 @@ const CustomEdit = React.memo(({ _type, _config, _toolName, onDelete, onCancel, newMcpServers = newMcpServers.mcpServers } // If transport is streamable, check if url is valid - if(newMcpServers.transport === "streamable" | newMcpServers.transport === "sse") { + if(newMcpServers.transport === "streamable" || newMcpServers.transport === "sse") { const urlValue = newMcpServers.url?.trim() || "" if(!urlValue) { return { isError: true, text: `tools.jsonFormatError.urlRequired${newMcpServers.transport}`, fieldKey: "url" } @@ -1116,10 +1116,10 @@ const CustomEdit = React.memo(({ _type, _config, _toolName, onDelete, onCancel, size="small" type="text" value={currentMcpServers.command || ""} - error={currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command"} + error={currentMcp.name && (currentMcpServers.command || currentMcpServers.url) && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command"} onChange={(e) => handleCustomChange("command", e.target.value)} /> - {currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command" ? ( + {currentMcp.name && (currentMcpServers.command || currentMcpServers.url) && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "command" ? (
handleCustomChange("url", e.target.value)} /> - {currentMcp.name && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "url" ? ( + {currentMcp.name && currentMcpServers.url && isValidCommandOrUrl(currentMcpServers)?.isError && isValidCommandOrUrl(currentMcpServers)?.fieldKey === "url" ? (