Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): mark Props of tools/mcp components as read-only (#25219) (#37251)

Rohit Gahlawatdad2e64a6274
diff --git a/web/app/components/tools/mcp/create-card.tsx b/web/app/components/tools/mcp/create-card.tsx
index 314735d5478..37be90e02cf 100644
--- a/web/app/components/tools/mcp/create-card.tsx
+++ b/web/app/components/tools/mcp/create-card.tsx
@@ -12,9 +12,9 @@ import { useDocLink } from '@/context/i18n'
import { useCreateMCP } from '@/service/use-tools'
import MCPModal from './modal'
-type Props = {
+type Props = Readonly<{
handleCreate: (provider: ToolWithProvider) => void
-}
+}>
const NewMCPCard = ({ handleCreate }: Props) => {
const { t } = useTranslation()
diff --git a/web/app/components/tools/mcp/detail/content.tsx b/web/app/components/tools/mcp/detail/content.tsx
index e78d88b7837..92d259bf6a6 100644
--- a/web/app/components/tools/mcp/detail/content.tsx
+++ b/web/app/components/tools/mcp/detail/content.tsx
@@ -37,13 +37,13 @@ import ListLoading from './list-loading'
import OperationDropdown from './operation-dropdown'
import ToolItem from './tool-item'
-type Props = {
+type Props = Readonly<{
detail: ToolWithProvider
onUpdate: (isDelete?: boolean) => void
onHide: () => void
isTriggerAuthorize: boolean
onFirstCreate: () => void
-}
+}>
type MCPModalConfirmPayload = Parameters<ComponentProps<typeof MCPModal>['onConfirm']>[0]
type MutationResult = {
diff --git a/web/app/components/tools/mcp/detail/operation-dropdown.tsx b/web/app/components/tools/mcp/detail/operation-dropdown.tsx
index 0c21e280a1d..a7231f01a18 100644
--- a/web/app/components/tools/mcp/detail/operation-dropdown.tsx
+++ b/web/app/components/tools/mcp/detail/operation-dropdown.tsx
@@ -16,12 +16,12 @@ import * as React from 'react'
import { useTranslation } from 'react-i18next'
import ActionButton from '@/app/components/base/action-button'
-type Props = {
+type Props = Readonly<{
inCard?: boolean
onOpenChange?: (open: boolean) => void
onEdit: () => void
onRemove: () => void
-}
+}>
const OperationDropdown: FC<Props> = ({
inCard,
diff --git a/web/app/components/tools/mcp/detail/provider-detail.tsx b/web/app/components/tools/mcp/detail/provider-detail.tsx
index e704e6d262f..8e246400195 100644
--- a/web/app/components/tools/mcp/detail/provider-detail.tsx
+++ b/web/app/components/tools/mcp/detail/provider-detail.tsx
@@ -13,13 +13,13 @@ import {
import * as React from 'react'
import MCPDetailContent from './content'
-type Props = {
+type Props = Readonly<{
detail?: ToolWithProvider
onUpdate: () => void
onHide: () => void
isTriggerAuthorize: boolean
onFirstCreate: () => void
-}
+}>
const MCPDetailPanel: FC<Props> = ({
detail,
diff --git a/web/app/components/tools/mcp/detail/tool-item.tsx b/web/app/components/tools/mcp/detail/tool-item.tsx
index f05890aee25..15877c3cef7 100644
--- a/web/app/components/tools/mcp/detail/tool-item.tsx
+++ b/web/app/components/tools/mcp/detail/tool-item.tsx
@@ -7,9 +7,9 @@ import { useTranslation } from 'react-i18next'
import { useLocale } from '@/context/i18n'
import { getLanguage } from '@/i18n-config/language'
-type Props = {
+type Props = Readonly<{
tool: Tool
-}
+}>
const MCPToolItem = ({
tool,
diff --git a/web/app/components/tools/mcp/headers-input.tsx b/web/app/components/tools/mcp/headers-input.tsx
index 58641d384bf..14bb2261fd4 100644
--- a/web/app/components/tools/mcp/headers-input.tsx
+++ b/web/app/components/tools/mcp/headers-input.tsx
@@ -14,12 +14,12 @@ export type HeaderItem = {
value: string
}
-type Props = {
+type Props = Readonly<{
headersItems: HeaderItem[]
onChange: (headerItems: HeaderItem[]) => void
readonly?: boolean
isMasked?: boolean
-}
+}>
const HeadersInput = ({
headersItems,
diff --git a/web/app/components/tools/mcp/index.tsx b/web/app/components/tools/mcp/index.tsx
index c634085c54f..1d135242d1f 100644
--- a/web/app/components/tools/mcp/index.tsx
+++ b/web/app/components/tools/mcp/index.tsx
@@ -10,9 +10,9 @@ import NewMCPCard from './create-card'
import MCPDetailPanel from './detail/provider-detail'
import MCPCard from './provider-card'
-type Props = {
+type Props = Readonly<{
searchText: string
-}
+}>
const MCPList = ({
searchText,
diff --git a/web/app/components/tools/mcp/mcp-server-param-item.tsx b/web/app/components/tools/mcp/mcp-server-param-item.tsx
index aed4378ebf5..8971d767f02 100644
--- a/web/app/components/tools/mcp/mcp-server-param-item.tsx
+++ b/web/app/components/tools/mcp/mcp-server-param-item.tsx
@@ -3,11 +3,11 @@ import { Textarea } from '@langgenius/dify-ui/textarea'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
-type Props = {
+type Props = Readonly<{
data?: any
value: string
onChange: (value: string) => void
-}
+}>
const MCPServerParamItem = ({
data,
diff --git a/web/app/components/tools/mcp/provider-card.tsx b/web/app/components/tools/mcp/provider-card.tsx
index 4536d96cad6..99d5a6a2b47 100644
--- a/web/app/components/tools/mcp/provider-card.tsx
+++ b/web/app/components/tools/mcp/provider-card.tsx
@@ -21,13 +21,13 @@ import { useDeleteMCP, useUpdateMCP } from '@/service/use-tools'
import OperationDropdown from './detail/operation-dropdown'
import MCPModal from './modal'
-type Props = {
+type Props = Readonly<{
currentProvider?: ToolWithProvider
data: ToolWithProvider
handleSelect: (providerID: string) => void
onUpdate: (providerID: string) => void
onDeleted: () => void
-}
+}>
const MCPCard = ({
currentProvider,