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 misc components as read-only (#25219) (#37294)

Rohit Gahlawat62a1476a9516
diff --git a/web/app/components/app-sidebar/app-sidebar-dropdown.tsx b/web/app/components/app-sidebar/app-sidebar-dropdown.tsx
index e3ed938987f..2b41e80a19d 100644
--- a/web/app/components/app-sidebar/app-sidebar-dropdown.tsx
+++ b/web/app/components/app-sidebar/app-sidebar-dropdown.tsx
@@ -21,7 +21,7 @@ import AppInfo from './app-info'
import { getAppModeLabel } from './app-info/app-mode-labels'
import NavLink from './nav-link'
-type Props = {
+type Props = Readonly<{
navigation: Array<{
name: string
href: string
@@ -29,7 +29,7 @@ type Props = {
selectedIcon: NavIcon
}>
appInfoActions?: AppInfoActions
-}
+}>
const AppSidebarDropdown = ({ navigation, appInfoActions }: Props) => {
const { t } = useTranslation()
diff --git a/web/app/components/apps/list.tsx b/web/app/components/apps/list.tsx
index 3e299beae44..321c104462e 100644
--- a/web/app/components/apps/list.tsx
+++ b/web/app/components/apps/list.tsx
@@ -37,9 +37,9 @@ const CreateFromDSLModal = dynamic(() => import('@/app/components/app/create-fro
ssr: false,
})
-type Props = {
+type Props = Readonly<{
controlRefreshList?: number
-}
+}>
function List({
controlRefreshList = 0,
}: Props) {
diff --git a/web/app/components/goto-anything/command-selector.tsx b/web/app/components/goto-anything/command-selector.tsx
index 3cadfd742db..815126a3836 100644
--- a/web/app/components/goto-anything/command-selector.tsx
+++ b/web/app/components/goto-anything/command-selector.tsx
@@ -6,14 +6,14 @@ import { useTranslation } from 'react-i18next'
import { usePathname } from '@/next/navigation'
import { slashCommandRegistry } from './actions/commands/registry'
-type Props = {
+type Props = Readonly<{
actions: Record<string, ActionItem>
onCommandSelect: (commandKey: string) => void
searchFilter?: string
commandValue?: string
onCommandValueChange?: (value: string) => void
originalQuery?: string
-}
+}>
const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, commandValue, onCommandValueChange, originalQuery }) => {
const { t } = useTranslation()
diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsx
index a9214534b82..29cb8983d25 100644
--- a/web/app/components/goto-anything/index.tsx
+++ b/web/app/components/goto-anything/index.tsx
@@ -18,9 +18,9 @@ import {
useGotoAnythingSearch,
} from './hooks'
-type Props = {
+type Props = Readonly<{
onHide?: () => void
-}
+}>
const GotoAnythingDialog: FC<Props> = ({
onHide,
diff --git a/web/app/components/snippet-list/components/snippet-card.tsx b/web/app/components/snippet-list/components/snippet-card.tsx
index 8b211b87367..55d73719ac7 100644
--- a/web/app/components/snippet-list/components/snippet-card.tsx
+++ b/web/app/components/snippet-list/components/snippet-card.tsx
@@ -30,12 +30,12 @@ import { useDeleteSnippetMutation, useExportSnippetMutation, useUpdateSnippetMut
import { downloadBlob } from '@/utils/download'
import { formatTime } from '@/utils/time'
-type Props = {
+type Props = Readonly<{
snippet: SnippetListItem
onOpenTagManagement?: () => void
onRefresh?: () => void
onTagsChange?: () => void
-}
+}>
const SnippetCard = ({
snippet,
diff --git a/web/context/app-list-context.ts b/web/context/app-list-context.ts
index 7164a07b9ec..6357df2dd73 100644
--- a/web/context/app-list-context.ts
+++ b/web/context/app-list-context.ts
@@ -2,12 +2,12 @@ import type { SetTryAppPanel, TryAppSelection } from '@/types/try-app'
import { noop } from 'es-toolkit/function'
import { createContext } from 'use-context-selector'
-type Props = {
+type Props = Readonly<{
currentApp?: TryAppSelection
isShowTryAppPanel: boolean
setShowTryAppPanel: SetTryAppPanel
controlHideCreateFromTemplatePanel: number
-}
+}>
const AppListContext = createContext<Props>({
isShowTryAppPanel: false,