From 62a1476a95165d70f5d2b9b503cd31b68a4685a0 Mon Sep 17 00:00:00 2001 From: Rohit Gahlawat Date: Wed, 10 Jun 2026 23:48:02 +0530 Subject: [PATCH] refactor(web): mark Props of misc components as read-only (#25219) (#37294) --- web/app/components/app-sidebar/app-sidebar-dropdown.tsx | 4 ++-- web/app/components/apps/list.tsx | 4 ++-- web/app/components/goto-anything/command-selector.tsx | 4 ++-- web/app/components/goto-anything/index.tsx | 4 ++-- web/app/components/snippet-list/components/snippet-card.tsx | 4 ++-- web/context/app-list-context.ts | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) 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 onCommandSelect: (commandKey: string) => void searchFilter?: string commandValue?: string onCommandValueChange?: (value: string) => void originalQuery?: string -} +}> const CommandSelector: FC = ({ 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 = ({ 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({ isShowTryAppPanel: false,