-
-
Notifications
You must be signed in to change notification settings - Fork 486
fix: refine placeholder rendering logic in MultipleContent component #1192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: refine placeholder rendering logic in MultipleContent component #1192
Conversation
|
@Wxh16144 is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Walkthrough将 MultipleContent 中 Placeholder 的渲染条件由依赖 Changes
Sequence Diagram(s)(跳过:变更为单组件内渲染条件调整,不满足生成序列图的条件) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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)
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 |
Summary of ChangesHello @Wxh16144, 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 a specific bug in 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. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refines the rendering logic for the placeholder in the MultipleContent component. The change simplifies the condition for displaying the placeholder by removing its dependency on the triggerOpen state. Now, the placeholder is shown only when there are no selected values and no search value. This correctly handles cases, especially with a controlled searchValue, where the placeholder was previously displayed incorrectly when the dropdown was closed. The change is correct and improves the component's behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/SelectInput/Content/MultipleContent.tsx`:
- Line 203: The placeholder visibility check currently uses searchValue but the
displayed input uses computedSearchValue (which may be cleared when the dropdown
closes via autoClearSearchValue), causing a brief mismatch; update the prefix
condition in MultipleContent (where prefix={!displayValues.length &&
!searchValue && <Placeholder />}) to use computedSearchValue (or inputValue)
instead of searchValue so the placeholder rendering matches the actual displayed
value state; ensure references to
computedSearchValue/autoClearSearchValue/inputValue are used consistently in
MultipleContent and any related render logic.
4ac268f to
30c15a8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1192 +/- ##
=======================================
Coverage 99.42% 99.42%
=======================================
Files 31 31
Lines 1219 1219
Branches 412 432 +20
=======================================
Hits 1212 1212
Misses 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
补个用例,和 single 一起各补一个一样逻辑的。 |
我是想补的,但是感觉这个 case 很难写,需要 |
bg: https://github.com/react-component/select/pull/1166/changes#r2707079879
fix: ant-design/ant-design#56587
Summary by CodeRabbit
发布说明
✏️ Tip: You can customize this high-level summary in your review settings.