From 1c0080be6f1e34b7226bb3ca1b356d733680d48f Mon Sep 17 00:00:00 2001 From: Archie Date: Fri, 5 Jun 2026 20:30:26 -0400 Subject: [PATCH] refactor(web): mark Props of datasets/hit-testing components as read-only (#37118) Co-authored-by: archievi <13202986+archievi@users.noreply.github.com> --- .../hit-testing/components/child-chunks-item.tsx | 4 ++-- .../hit-testing/components/result-item-external.tsx | 4 ++-- .../hit-testing/components/result-item-footer.tsx | 6 +++--- .../hit-testing/components/result-item-meta.tsx | 10 +++++----- .../datasets/hit-testing/components/score.tsx | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx b/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx index dccf868b30..e467c90525 100644 --- a/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx +++ b/web/app/components/datasets/hit-testing/components/child-chunks-item.tsx @@ -6,8 +6,8 @@ import { SliceContent } from '../../formatted-text/flavours/shared' import Score from './score' type Props = { - payload: HitTestingChildChunk - isShowAll: boolean + readonly payload: HitTestingChildChunk + readonly isShowAll: boolean } const ChildChunks: FC = ({ diff --git a/web/app/components/datasets/hit-testing/components/result-item-external.tsx b/web/app/components/datasets/hit-testing/components/result-item-external.tsx index 069ad8fa59..a585ef9cb4 100644 --- a/web/app/components/datasets/hit-testing/components/result-item-external.tsx +++ b/web/app/components/datasets/hit-testing/components/result-item-external.tsx @@ -12,8 +12,8 @@ import ResultItemMeta from './result-item-meta' const i18nPrefix = '' type Props = { - payload: ExternalKnowledgeBaseHitTesting - positionId: number + readonly payload: ExternalKnowledgeBaseHitTesting + readonly positionId: number } const ResultItemExternal: FC = ({ payload, positionId }) => { diff --git a/web/app/components/datasets/hit-testing/components/result-item-footer.tsx b/web/app/components/datasets/hit-testing/components/result-item-footer.tsx index bb1b7c172d..41e9558e83 100644 --- a/web/app/components/datasets/hit-testing/components/result-item-footer.tsx +++ b/web/app/components/datasets/hit-testing/components/result-item-footer.tsx @@ -7,9 +7,9 @@ import { useTranslation } from 'react-i18next' import FileIcon from '@/app/components/base/file-uploader/file-type-icon' type Props = { - docType: FileAppearanceTypeEnum - docTitle: string - showDetailModal: () => void + readonly docType: FileAppearanceTypeEnum + readonly docTitle: string + readonly showDetailModal: () => void } const i18nPrefix = '' diff --git a/web/app/components/datasets/hit-testing/components/result-item-meta.tsx b/web/app/components/datasets/hit-testing/components/result-item-meta.tsx index dc017df4eb..9a41a64ac1 100644 --- a/web/app/components/datasets/hit-testing/components/result-item-meta.tsx +++ b/web/app/components/datasets/hit-testing/components/result-item-meta.tsx @@ -8,11 +8,11 @@ import { SegmentIndexTag } from '../../documents/detail/completed/common/segment import Score from './score' type Props = { - labelPrefix: string - positionId: number - wordCount: number - score: number - className?: string + readonly labelPrefix: string + readonly positionId: number + readonly wordCount: number + readonly score: number + readonly className?: string } const ResultItemMeta: FC = ({ diff --git a/web/app/components/datasets/hit-testing/components/score.tsx b/web/app/components/datasets/hit-testing/components/score.tsx index 3cdad3f152..b7026eb87b 100644 --- a/web/app/components/datasets/hit-testing/components/score.tsx +++ b/web/app/components/datasets/hit-testing/components/score.tsx @@ -4,8 +4,8 @@ import { cn } from '@langgenius/dify-ui/cn' import * as React from 'react' type Props = { - value: number | null - besideChunkName?: boolean + readonly value: number | null + readonly besideChunkName?: boolean } const Score: FC = ({