Skip to content

fix: preserve zero-valued dropdown content and icons - #1254

Open
QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:fix-react-node-guards
Open

QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:fix-react-node-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

说明

  • notFoundContent={0} 可以打开并显示空列表;menuItemSelectedIcon={0} 仅在选中项中显示。
  • 统一选项 label 与单选值展示的可渲染/非空判断,保留现有空白字符串处理。
  • 补充空列表、选中图标及零值选项标签测试。

验证

  • npm test -- --runInBand(446 项通过)
  • npm run tsc
  • 改动源码 ESLint 检查通过。

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • 问题修复

    • 修正下拉空状态、选择图标和选项标签的显示判断,使 0 等有效内容能够正确显示。
    • 调整单选值及输入内容的空值处理,避免有效标签被错误清空。
  • 测试

    • 新增测试,覆盖空状态内容、零值选择图标及零值标签的显示。

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@QDyanbing is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 40e46780-39e3-4a85-85bb-dcf4e818767e

📥 Commits

Reviewing files that changed from the base of the PR and between 59dd34a and ae0f936.

📒 Files selected for processing (5)
  • src/BaseSelect/index.tsx
  • src/OptionList.tsx
  • src/Select.tsx
  • src/SelectInput/Content/SingleContent.tsx
  • tests/renderability.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

本次更新调整选择器对零值和其他可渲染内容的判断,涉及下拉空状态、选项图标、选项标签及单选值显示。新增测试覆盖零值空状态、图标和选项标签。

Changes

可渲染内容处理

Layer / File(s) Summary
下拉空状态判断
src/BaseSelect/index.tsx, tests/renderability.test.tsx
当选项为空且 notFoundContent 不可渲染时,设置空列表内容状态。新增测试验证 notFoundContent={0} 会显示 0。
选项与单选值显示
src/OptionList.tsx, src/Select.tsx, src/SelectInput/Content/SingleContent.tsx, tests/renderability.test.tsx
选项图标和标签改用可渲染性判断。单选值及内容区域改用非空值判断。新增测试验证零值图标仅显示于选中项,并验证零值标签显示在选项和已选值区域。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: afc163

Merge Risk: ⚪ Minimal · up to ae0f9

The changes preserve zero-valued dropdown content, icons, and labels. The inspected empty-label case still displays the option value, and no concrete merge-blocking issue remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更的主要目标:保留下拉内容和图标中的零值。标题简洁、明确,并与代码和测试变更一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

我是小兔,蹦来看新判断
零值也能留在菜单上
空状态里,零字清亮
选中图标乖乖守在旁
我竖起耳朵,为测试鼓掌

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.46%. Comparing base (59dd34a) to head (ae0f936).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1254      +/-   ##
==========================================
- Coverage   99.46%   99.46%   -0.01%     
==========================================
  Files          31       31              
  Lines        1307     1304       -3     
  Branches      477      452      -25     
==========================================
- Hits         1300     1297       -3     
  Misses          7        7              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant