Skip to content

Conversation

@zombieJ
Copy link
Member

@zombieJ zombieJ commented Feb 12, 2026

fix ant-design/ant-design#56973

Summary by CodeRabbit

发布说明

重构

  • 简化了选择组件的内部值检查逻辑,提升代码清晰度。
  • 优化了对应的测试用例以适配这些变更。

@vercel
Copy link

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
select Ready Ready Preview, Comment Feb 12, 2026 5:48pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Caution

Review failed

The pull request is closed.

高层概述

本 PR 在 SingleContent.tsx 中用直接的 displayValue 真值检查替换了 hasDisplayValue 标志,影响选项解析、标题设置、值渲染和 CSS 类名应用的逻辑,同时删除了相关测试用例。

变更

应用范围 / 文件 摘要
渲染逻辑简化
src/SelectInput/Content/SingleContent.tsx
displayValue 的直接真值检查替换 hasDisplayValue 标志,影响选项解析、标题解析、renderValue 判断和 .rc-select-content-has-value 类名应用。
测试调整
tests/placeholder.test.tsx
删除测试用例,该用例断言当 Select 值为空字符串时存在 .rc-select-content-has-value 类。

估计代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

可能相关的 PR

建议审阅者

  • meet-student

诗文

🐰 一个标志退去舞台,
displayValue 直言不讳,
空字符串不再伪装,
组件高度终于稳定,
Select 的故事重新开始!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-value

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 and usage tips.

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.43%. Comparing base (e68b129) to head (47f1baa).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1206      +/-   ##
==========================================
- Coverage   99.43%   99.43%   -0.01%     
==========================================
  Files          31       31              
  Lines        1231     1230       -1     
  Branches      420      439      +19     
==========================================
- Hits         1224     1223       -1     
  Misses          7        7              

☔ View full report in Codecov by Sentry.
📢 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.

@zombieJ zombieJ merged commit 95fea7c into master Feb 12, 2026
11 of 12 checks passed
@zombieJ zombieJ deleted the fix-value branch February 12, 2026 17:50
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue with the Select component's handling of empty string values by simplifying its internal logic for determining if a display value exists. It streamlines the code by removing an unnecessary intermediate variable and directly utilizing the display value for conditional checks and rendering. Corresponding test cases have been adjusted to align with these changes, improving code clarity and maintainability.

Highlights

  • Refactored Value Checking Logic: The hasDisplayValue boolean variable was removed from SingleContent.tsx, and conditional checks now directly use the displayValue.
  • Simplified Conditional Rendering: Updated several conditional rendering and class assignment statements to directly check displayValue instead of the now-removed hasDisplayValue.
  • Test Case Removal: A specific test case in placeholder.test.tsx that checked for the content-has-value class when the Select component had an empty string value was removed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/SelectInput/Content/SingleContent.tsx
    • Removed the hasDisplayValue variable.
    • Updated conditional statements to directly use displayValue for checks related to styling and rendering.
  • tests/placeholder.test.tsx
    • Removed a test case verifying the content-has-value class for empty string values.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次变更简化了 SingleContent 组件中的值检查逻辑,将 hasDisplayValue 变量替换为对 displayValue 的直接检查,这使得代码更加简洁清晰。然而,一个关于空字符串值的测试用例被移除了。考虑到这是一个重要的边界情况,移除测试可能会在未来引入回归风险,因此我建议恢复该测试以保证代码质量和健壮性。

I am having trouble creating individual review comments. Click here to see my feedback.

tests/placeholder.test.tsx (44-49)

medium

移除这个针对空字符串值的测试用例会降低代码的测试覆盖率。这是一个重要的边界条件,保留该测试有助于防止未来出现回归问题。建议恢复此测试,以确保组件在值为空字符串时能正确显示,并与未选择任何值的状态区分开来。

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.

Select height is not right when value=""

1 participant