From 47f1baa4b1dbb1f25101af90ce27f137ad64b2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 13 Feb 2026 01:43:50 +0800 Subject: [PATCH] Revert "fix: use strict null/undefined check for display value in single select (#1205)" This reverts commit f781118b7a5d0b0d8bb1af5fa5a8939a8cbeafe0. --- src/SelectInput/Content/SingleContent.tsx | 9 ++++----- tests/placeholder.test.tsx | 7 ------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/SelectInput/Content/SingleContent.tsx b/src/SelectInput/Content/SingleContent.tsx index d5237f8c..3a731a38 100644 --- a/src/SelectInput/Content/SingleContent.tsx +++ b/src/SelectInput/Content/SingleContent.tsx @@ -19,7 +19,6 @@ const SingleContent = React.forwardRef( const combobox = mode === 'combobox'; const displayValue = displayValues[0]; - const hasDisplayValue = displayValue !== null && displayValue !== undefined; // Implement the same logic as the old SingleSelector const mergedSearchValue = React.useMemo(() => { @@ -35,7 +34,7 @@ const SingleContent = React.forwardRef( let style: React.CSSProperties | undefined; let titleValue: string | undefined; - if (hasDisplayValue && selectContext?.flattenOptions) { + if (displayValue && selectContext?.flattenOptions) { const option = selectContext.flattenOptions.find((opt) => opt.value === displayValue.value); if (option?.data) { className = option.data.className; @@ -44,7 +43,7 @@ const SingleContent = React.forwardRef( } } - if (hasDisplayValue && !titleValue) { + if (displayValue && !titleValue) { titleValue = getTitle(displayValue); } @@ -65,7 +64,7 @@ const SingleContent = React.forwardRef( // ========================== Render ========================== // Render value - const renderValue = hasDisplayValue ? ( + const renderValue = displayValue ? ( hasOptionStyle ? (
(
{ }); expect(container.querySelector('.rc-select-placeholder').textContent).toBe('placeholder'); }); - - it('should have content-has-value class when value is empty string', () => { - const { container } = render( -