From 80567681064177904d8907b6b43c7d91a350036a Mon Sep 17 00:00:00 2001 From: byteforge Date: Tue, 20 Jan 2026 10:08:59 -0500 Subject: [PATCH] fix: enforce no-leaked-conditional-rendering as error and fix violations (#31262) Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com> --- web/app/components/app-sidebar/dataset-info/index.tsx | 2 +- web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx | 2 +- .../app/annotation/edit-annotation-modal/index.tsx | 2 +- .../app/configuration/base/feature-panel/index.tsx | 6 +++--- .../app/configuration/dataset-config/card-item/index.tsx | 2 +- .../configuration/dataset-config/select-dataset/index.tsx | 2 +- .../configuration/dataset-config/settings-modal/index.tsx | 2 +- .../debug/debug-with-single-model/index.spec.tsx | 4 ++-- web/app/components/base/agent-log-modal/tool-call.tsx | 2 +- web/app/components/base/chat/chat/answer/index.tsx | 2 +- web/app/components/base/chat/chat/answer/more.tsx | 2 +- web/app/components/base/chat/chat/citation/popup.tsx | 2 +- .../components/base/image-uploader/chat-image-uploader.tsx | 2 +- web/app/components/base/input/index.tsx | 2 +- web/app/components/base/modal/index.tsx | 4 ++-- web/app/components/base/modal/modal.tsx | 4 ++-- web/app/components/base/radio-card/index.tsx | 2 +- web/app/components/base/radio/component/radio/index.tsx | 2 +- web/app/components/base/segmented-control/index.tsx | 2 +- web/app/components/base/select/index.tsx | 2 +- web/app/components/base/toast/index.tsx | 2 +- web/app/components/base/tooltip/content.tsx | 4 ++-- web/app/components/base/tooltip/index.tsx | 2 +- .../datasets/create/step-two/components/option-card.tsx | 4 ++-- web/app/components/datasets/documents/components/list.tsx | 2 +- .../processing/embedding-process/rule-detail.spec.tsx | 2 +- .../list/dataset-card/components/dataset-card-header.tsx | 2 +- .../metadata/metadata-dataset/create-content.spec.tsx | 2 +- web/app/components/datasets/settings/form/index.tsx | 6 +++--- web/app/components/datasets/settings/option-card.tsx | 4 ++-- .../model-provider-page/model-name/index.tsx | 6 +++--- .../model-provider-page/model-selector/popup-item.tsx | 6 +++--- web/app/components/plugins/card/index.spec.tsx | 2 +- web/app/components/plugins/card/index.tsx | 2 +- .../install-from-github/steps/loaded.spec.tsx | 2 +- .../install-from-marketplace/steps/install.spec.tsx | 2 +- web/app/components/plugins/marketplace/index.spec.tsx | 2 +- web/app/components/plugins/marketplace/list/index.spec.tsx | 2 +- .../plugins/plugin-detail-panel/detail-header.tsx | 4 ++-- .../subscription-list/edit/index.spec.tsx | 2 +- .../components/plugins/plugin-mutation-model/index.spec.tsx | 2 +- web/app/components/tools/provider/empty.tsx | 2 +- .../workflow/nodes/_base/components/editor/base.tsx | 4 ++-- .../components/workflow/nodes/_base/components/field.tsx | 6 +++--- .../workflow/nodes/_base/components/prompt/editor.tsx | 2 +- .../variable/variable-label/base/variable-label.tsx | 2 +- web/app/components/workflow/nodes/_base/node.tsx | 6 +++--- .../workflow/nodes/assigner/components/var-list/index.tsx | 2 +- web/app/components/workflow/nodes/assigner/node.tsx | 2 +- .../knowledge-base/components/chunk-structure/index.tsx | 2 +- .../nodes/knowledge-base/components/option-card.tsx | 4 ++-- web/app/components/workflow/nodes/knowledge-base/panel.tsx | 2 +- .../nodes/knowledge-retrieval/components/dataset-item.tsx | 2 +- .../components/metadata/condition-list/condition-date.tsx | 2 +- .../workflow/nodes/llm/components/config-prompt-item.tsx | 2 +- .../workflow/nodes/loop/components/condition-list/index.tsx | 2 +- .../panel/debug-and-preview/conversation-variable-modal.tsx | 2 +- .../components/workflow/run/agent-log/agent-log-item.tsx | 2 +- web/tsslint.config.ts | 2 +- 59 files changed, 80 insertions(+), 80 deletions(-) diff --git a/web/app/components/app-sidebar/dataset-info/index.tsx b/web/app/components/app-sidebar/dataset-info/index.tsx index 2d2eeefbb2..ba82099b6c 100644 --- a/web/app/components/app-sidebar/dataset-info/index.tsx +++ b/web/app/components/app-sidebar/dataset-info/index.tsx @@ -71,7 +71,7 @@ const DatasetInfo: FC = ({
{isExternalProvider && t('externalTag', { ns: 'dataset' })} - {!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique && ( + {!!(!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique) && (
{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })} {formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)} diff --git a/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx b/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx index 4ba9814255..c81125e973 100644 --- a/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx +++ b/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx @@ -114,7 +114,7 @@ const DatasetSidebarDropdown = ({
{isExternalProvider && t('externalTag', { ns: 'dataset' })} - {!isExternalProvider && dataset.doc_form && dataset.indexing_technique && ( + {!!(!isExternalProvider && dataset.doc_form && dataset.indexing_technique) && (
{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })} {formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)} diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx index b7f7cd1600..2595ec38b2 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx @@ -144,7 +144,7 @@ const EditAnnotationModal: FC = ({
{t('editModal.removeThisCache', { ns: 'appAnnotation' })}
- {createdAt && ( + {!!createdAt && (
{t('editModal.createdAt', { ns: 'appAnnotation' })}   diff --git a/web/app/components/app/configuration/base/feature-panel/index.tsx b/web/app/components/app/configuration/base/feature-panel/index.tsx index 06ae2ab10a..7f337c1572 100644 --- a/web/app/components/app/configuration/base/feature-panel/index.tsx +++ b/web/app/components/app/configuration/base/feature-panel/index.tsx @@ -28,16 +28,16 @@ const FeaturePanel: FC = ({
- {headerIcon &&
{headerIcon}
} + {!!headerIcon &&
{headerIcon}
}
{title}
- {headerRight &&
{headerRight}
} + {!!headerRight &&
{headerRight}
}
{/* Body */} - {children && ( + {!!children && (
{children}
diff --git a/web/app/components/app/configuration/dataset-config/card-item/index.tsx b/web/app/components/app/configuration/dataset-config/card-item/index.tsx index 81c2b470ad..00d3f6d6ad 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/index.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/index.tsx @@ -91,7 +91,7 @@ const Item: FC = ({
{ - config.indexing_technique && ( + !!config.indexing_technique && ( = ({
)} { - item.indexing_technique && ( + !!item.indexing_technique && ( = ({ />
- {currentDataset && currentDataset.indexing_technique && ( + {!!(currentDataset && currentDataset.indexing_technique) && (
{t('form.indexMethod', { ns: 'datasetSettings' })}
diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx index b9a1c5ba8b..08bdd2bfcb 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx @@ -465,8 +465,8 @@ vi.mock('@/app/components/base/chat/chat', () => ({
))}
- {questionIcon &&
{questionIcon}
} - {answerIcon &&
{answerIcon}
} + {!!questionIcon &&
{questionIcon}
} + {!!answerIcon &&
{answerIcon}
}