refactor(web): mark Props of (commonLayout) components as read-only (#25219) (#37291)

This commit is contained in:
Rohit Gahlawat 2026-06-10 23:50:30 +05:30 committed by GitHub
parent be2034f681
commit 162c478368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 22 additions and 22 deletions

View File

@ -13,11 +13,11 @@ type TimePeriodOption = {
name: string
}
type Props = {
type Props = Readonly<{
periodMapping: { [key: string]: { value: number, name: TimePeriodName } }
onSelect: (payload: PeriodParams) => void
queryDateFormat: string
}
}>
const today = dayjs()

View File

@ -12,12 +12,12 @@ import Picker from '@/app/components/base/date-and-time-picker/date-picker'
import { useLocale } from '@/context/i18n'
import { formatToLocalTime } from '@/utils/format'
type Props = {
type Props = Readonly<{
start: Dayjs
end: Dayjs
onStartChange: (date?: Dayjs) => void
onEndChange: (date?: Dayjs) => void
}
}>
const today = dayjs()
const DatePicker: FC<Props> = ({

View File

@ -16,11 +16,11 @@ const today = dayjs()
type TimePeriodName = I18nKeysByPrefix<'appLog', 'filter.period.'>
type Props = {
type Props = Readonly<{
ranges: { value: number, name: TimePeriodName }[]
onSelect: (payload: PeriodParams) => void
queryDateFormat: string
}
}>
const TimeRangePicker: FC<Props> = ({
ranges,

View File

@ -17,11 +17,11 @@ type TimePeriodOption = {
name: string
}
type Props = {
type Props = Readonly<{
isCustomRange: boolean
ranges: { value: number, name: TimePeriodName }[]
onSelect: (payload: PeriodParamsWithTimeRange) => void
}
}>
const RangeSelector: FC<Props> = ({
isCustomRange,

View File

@ -12,12 +12,12 @@ import * as React from 'react'
import { useState } from 'react'
import ConfigPopup from './config-popup'
type Props = {
type Props = Readonly<{
readOnly: boolean
className?: string
hasConfigured: boolean
children?: React.ReactNode
} & PopupProps
}> & PopupProps
const ConfigBtn: FC<Props> = ({
className,

View File

@ -4,7 +4,7 @@ import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import Input from '@/app/components/base/input'
type Props = {
type Props = Readonly<{
className?: string
label: string
labelClassName?: string
@ -12,7 +12,7 @@ type Props = {
onChange: (value: string) => void
isRequired?: boolean
placeholder?: string
}
}>
const Field: FC<Props> = ({
className,

View File

@ -28,7 +28,7 @@ import { docURL } from './config'
import Field from './field'
import { TracingProvider } from './type'
type Props = {
type Props = Readonly<{
appId: string
type: TracingProvider
payload?: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig | MLflowConfig | DatabricksConfig | TencentConfig | null
@ -36,7 +36,7 @@ type Props = {
onCancel: () => void
onSaved: (payload: ArizeConfig | PhoenixConfig | LangSmithConfig | LangFuseConfig | OpikConfig | WeaveConfig | AliyunConfig | MLflowConfig | DatabricksConfig | TencentConfig) => void
onChosen: (provider: TracingProvider) => void
}
}>
const I18N_PREFIX = 'tracing.configProvider'

View File

@ -13,7 +13,7 @@ import { TracingProvider } from './type'
const I18N_PREFIX = 'tracing'
type Props = {
type Props = Readonly<{
type: TracingProvider
readOnly: boolean
isChosen: boolean
@ -21,7 +21,7 @@ type Props = {
onChoose: () => void
hasConfigured: boolean
onConfig: () => void
}
}>
const getIcon = (type: TracingProvider) => {
return ({

View File

@ -4,10 +4,10 @@ import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import { TracingIcon as Icon } from '@/app/components/base/icons/src/public/tracing'
type Props = {
type Props = Readonly<{
className?: string
size: 'lg' | 'md'
}
}>
const sizeClassMap = {
lg: 'w-9 h-9 p-2 rounded-[10px]',

View File

@ -1,9 +1,9 @@
import * as React from 'react'
import Main from '@/app/components/datasets/hit-testing'
type Props = {
type Props = Readonly<{
params: Promise<{ datasetId: string }>
}
}>
const HitTesting = async (props: Props) => {
const params = await props.params

View File

@ -5,10 +5,10 @@ import { useTranslation } from 'react-i18next'
import { FullScreenLoading } from '@/app/components/full-screen-loading'
import { isLegacyBase401 } from '@/features/account-profile/client'
type Props = {
type Props = Readonly<{
error: Error & { digest?: string }
unstable_retry: () => void
}
}>
export default function CommonLayoutError({ error, unstable_retry }: Props) {
const { t } = useTranslation('common')