fix: use strict null/undefined check for display value in single select#1205
fix: use strict null/undefined check for display value in single select#1205
Conversation
Empty string values should be treated as valid values (having a display value), not as missing values. This fixes the content-has-value class not being applied when the value is an empty string. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough在 SingleContent.tsx 中引入 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1205 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 31 31
Lines 1230 1231 +1
Branches 441 420 -21
=======================================
+ Hits 1223 1224 +1
Misses 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary of ChangesHello @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 fixes a rendering bug in the single select component where an empty string value was not recognized as a valid selection, leading to incorrect CSS class application. By implementing a more precise check for the presence of a display value, the component now correctly applies the Highlights
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request addresses a bug where empty string values in the single select component were not being treated as valid, leading to incorrect rendering. The change to use a strict check for null and undefined to determine the presence of a display value is the correct approach, as it properly handles falsy values like empty strings. The introduction of the hasDisplayValue constant is a good refactoring that improves code clarity and maintainability. Additionally, the new test case effectively verifies the fix. The changes are well-implemented and resolve the reported issue.
* Revert "fix: use strict null/undefined check for display value in single select (#1205)" This reverts commit f781118. * fix: check displayValue label before adding -content-has-value className Ensures the -content-has-value className is only added when displayValue has a truthy label property, preventing the class from being added when value is empty or null. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Empty string values should be treated as valid values (having a display value), not as missing values. This fixes the content-has-value class not being applied when the value is an empty string.
fix ant-design/ant-design#56973
Summary by CodeRabbit
发行说明
Bug 修复
测试