From 50e23f40a449c61011b98685dbe2206a9010a0b1 Mon Sep 17 00:00:00 2001 From: Rohit Gahlawat Date: Wed, 10 Jun 2026 07:41:23 +0530 Subject: [PATCH] refactor(web): mark Props of tools/ components as read-only (#25219) (#37255) --- .../tools/edit-custom-collection-modal/config-credentials.tsx | 4 ++-- .../tools/edit-custom-collection-modal/get-schema.tsx | 4 ++-- .../components/tools/edit-custom-collection-modal/index.tsx | 4 ++-- .../tools/edit-custom-collection-modal/test-api.tsx | 4 ++-- web/app/components/tools/provider/custom-create-card.tsx | 4 ++-- web/app/components/tools/provider/detail.tsx | 4 ++-- web/app/components/tools/provider/empty.tsx | 4 ++-- web/app/components/tools/provider/tool-item.tsx | 4 ++-- .../components/tools/setting/build-in/config-credentials.tsx | 4 ++-- web/app/components/tools/workflow-tool/configure-button.tsx | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx index dcbf834ede..0c5c762063 100644 --- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx @@ -23,12 +23,12 @@ import { useTranslation } from 'react-i18next' import { Infotip } from '@/app/components/base/infotip' import { AuthHeaderPrefix, AuthType } from '@/app/components/tools/types' -type Props = { +type Props = Readonly<{ positionCenter?: boolean credential: Credential onChange: (credential: Credential) => void onHide: () => void -} +}> type ItemProps = { text: string diff --git a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx index b07d21ce14..a27b52e2a9 100644 --- a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx @@ -15,9 +15,9 @@ import Input from '@/app/components/base/input' import { importSchemaFromURL } from '@/service/tools' import examples from './examples' -type Props = { +type Props = Readonly<{ onChange: (value: string) => void -} +}> const GetSchema: FC = ({ onChange, diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsx index 6806a78ada..ef3218bb57 100644 --- a/web/app/components/tools/edit-custom-collection-modal/index.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx @@ -33,7 +33,7 @@ import ConfigCredentials from './config-credentials' import GetSchema from './get-schema' import TestApi from './test-api' -type Props = { +type Props = Readonly<{ positionLeft?: boolean dialogClassName?: string payload: any @@ -41,7 +41,7 @@ type Props = { onAdd?: (payload: CustomCollectionBackend) => void onRemove?: () => void onEdit?: (payload: CustomCollectionBackend) => void -} +}> // Add and Edit const EditCustomCollectionModal: FC = ({ positionLeft, diff --git a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx index d53cab8c8a..b438bf859e 100644 --- a/web/app/components/tools/edit-custom-collection-modal/test-api.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/test-api.tsx @@ -24,12 +24,12 @@ import { getLanguage } from '@/i18n-config/language' import { testAPIAvailable } from '@/service/tools' import ConfigCredentials from './config-credentials' -type Props = { +type Props = Readonly<{ positionCenter?: boolean customCollection: CustomCollectionBackend tool: CustomParamSchema onHide: () => void -} +}> const TestApi: FC = ({ positionCenter, diff --git a/web/app/components/tools/provider/custom-create-card.tsx b/web/app/components/tools/provider/custom-create-card.tsx index 90c597de15..0879d2cd0d 100644 --- a/web/app/components/tools/provider/custom-create-card.tsx +++ b/web/app/components/tools/provider/custom-create-card.tsx @@ -10,9 +10,9 @@ import EditCustomToolModal from '@/app/components/tools/edit-custom-collection-m import { useAppContext } from '@/context/app-context' import { createCustomCollection } from '@/service/tools' -type Props = { +type Props = Readonly<{ onRefreshData: () => void -} +}> const Contribute = ({ onRefreshData }: Props) => { const { t } = useTranslation() diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsx index ff64e0044c..597c7b1097 100644 --- a/web/app/components/tools/provider/detail.tsx +++ b/web/app/components/tools/provider/detail.tsx @@ -63,11 +63,11 @@ import { basePath } from '@/utils/var' import { AuthHeaderPrefix, AuthType, CollectionType } from '../types' import ToolItem from './tool-item' -type Props = { +type Props = Readonly<{ collection: Collection onHide: () => void onRefreshData: () => void -} +}> const ProviderDetail = ({ collection, diff --git a/web/app/components/tools/provider/empty.tsx b/web/app/components/tools/provider/empty.tsx index 5d86708f57..5b98a2937e 100644 --- a/web/app/components/tools/provider/empty.tsx +++ b/web/app/components/tools/provider/empty.tsx @@ -7,10 +7,10 @@ import Link from '@/next/link' import { NoToolPlaceholder } from '../../base/icons/src/vender/other' import { ToolTypeEnum } from '../../workflow/block-selector/types' -type Props = { +type Props = Readonly<{ type?: ToolTypeEnum isAgent?: boolean -} +}> const getLink = (type?: ToolTypeEnum) => { switch (type) { diff --git a/web/app/components/tools/provider/tool-item.tsx b/web/app/components/tools/provider/tool-item.tsx index 83ffd465db..09e52e3436 100644 --- a/web/app/components/tools/provider/tool-item.tsx +++ b/web/app/components/tools/provider/tool-item.tsx @@ -7,13 +7,13 @@ import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/ import { useLocale } from '@/context/i18n' import { getLanguage } from '@/i18n-config/language' -type Props = { +type Props = Readonly<{ disabled?: boolean collection: Collection tool: Tool isBuiltIn: boolean isModel: boolean -} +}> const ToolItem = ({ disabled, diff --git a/web/app/components/tools/setting/build-in/config-credentials.tsx b/web/app/components/tools/setting/build-in/config-credentials.tsx index ed54572070..a7ef23657d 100644 --- a/web/app/components/tools/setting/build-in/config-credentials.tsx +++ b/web/app/components/tools/setting/build-in/config-credentials.tsx @@ -26,14 +26,14 @@ import Form from '@/app/components/header/account-setting/model-provider-page/mo import { fetchBuiltInToolCredential, fetchBuiltInToolCredentialSchema } from '@/service/tools' import { addDefaultValue, toolCredentialToFormSchemas } from '../../utils/to-form-schema' -type Props = { +type Props = Readonly<{ collection: Collection onCancel: () => void onSaved: (value: Record) => void isHideRemoveBtn?: boolean onRemove?: () => void isSaving?: boolean -} +}> const ConfigCredential: FC = ({ collection, diff --git a/web/app/components/tools/workflow-tool/configure-button.tsx b/web/app/components/tools/workflow-tool/configure-button.tsx index 0adc923e48..19dcf29dcf 100644 --- a/web/app/components/tools/workflow-tool/configure-button.tsx +++ b/web/app/components/tools/workflow-tool/configure-button.tsx @@ -7,7 +7,7 @@ import Loading from '@/app/components/base/loading' import { useRouter } from '@/next/navigation' import Divider from '../../base/divider' -type Props = { +type Props = Readonly<{ disabled: boolean published: boolean isLoading: boolean @@ -15,7 +15,7 @@ type Props = { isCurrentWorkspaceManager: boolean onConfigure: () => void disabledReason?: string -} +}> const WorkflowToolConfigureButton = ({ disabled,