Skip to content

Conversation

@Wxh16144
Copy link
Contributor

@Wxh16144 Wxh16144 commented Jan 20, 2026

bg: https://github.com/react-component/select/pull/1166/changes#r2707079879
fix: ant-design/ant-design#56587

Summary by CodeRabbit

发布说明

  • Bug修复
    • 优化了多选输入框占位符显示逻辑:仅在无显示值且输入框为空时显示,移除对搜索/触发打开状态的依赖,提升一致性与可预测性。
  • 测试
    • 新增自动化测试,验证标签模式下占位符在初始与输入后行为符合预期。

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 20, 2026

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

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

将 MultipleContent 中 Placeholder 的渲染条件由依赖 searchValue/triggerOpen 收紧为仅在无 displayValuesinputValue 为假值时渲染;新增测试覆盖 tags 模式下 open={false} 时占位符随输入消失的行为。

Changes

内聚组 / 文件(s) 变更摘要
占位符渲染逻辑
src/SelectInput/Content/MultipleContent.tsx
调整 Placeholder 渲染条件:仅在没有 displayValuesinputValue 为假值时渲染;移除对 triggerOpensearchValue 的依赖,修复 tags 模式下 open={false} 时占位符不消失的问题。
单元测试
tests/Tags.test.tsx
新增用例:在 mode="tags"open={false} 场景下,验证占位符初始可见且在用户输入后隐藏(模拟输入行为)。

Sequence Diagram(s)

(跳过:变更为单组件内渲染条件调整,不满足生成序列图的条件)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • afc163
  • zombieJ

Poem

🐰 轻跳到代码园,
占位符在风中眠,
输入一声它即隐,
tags 下不再留痕迹,
小改一行笑颜展 ✨

🚥 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 标题明确总结了主要变更:改进MultipleContent组件中的占位符渲染逻辑。
Linked Issues check ✅ Passed 代码变更通过修改占位符渲染条件,使其直接依赖inputValue而非searchValue和triggerOpen,从而修复tags模式下open={false}时输入不隐藏占位符的问题,符合#56587的核心要求。
Out of Scope Changes check ✅ Passed 所有代码变更均与修复占位符渲染逻辑的目标相关,包括MultipleContent.tsx的逻辑调整和新增测试用例,不存在超出范围的修改。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 MultipleContent component's placeholder display. By adjusting the rendering condition, the placeholder will now accurately reflect the component's state, appearing only when there are no selected values and no active search input, thereby improving the user experience and component behavior.

Highlights

  • Placeholder Rendering Logic: Refined the conditional logic for rendering the Placeholder component in MultipleContent.tsx to ensure it only appears when no items are selected and no search value is present. This resolves an issue where the placeholder might have been displayed under incorrect conditions.

🧠 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 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

@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

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.

@Wxh16144 Wxh16144 force-pushed the wuxh/fix-antd-56587 branch from 4ac268f to 30c15a8 Compare January 20, 2026 07:40
@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.42%. Comparing base (947131a) to head (d0dcbaa).
⚠️ Report is 1 commits behind head on master.

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.
📢 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.

@afc163
Copy link
Member

afc163 commented Jan 20, 2026

补个用例,和 single 一起各补一个一样逻辑的。

@Wxh16144
Copy link
Contributor Author

补个用例,和 single 一起各补一个一样逻辑的。

我是想补的,但是感觉这个 case 很难写,需要 open={false} and mode="tags" 的时候才会触发 issue 描述中的错误

@zombieJ zombieJ merged commit 65f03bb into react-component:master Jan 20, 2026
9 of 10 checks passed
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组件tags模式下open={false},导致输入时,placeholder不消失

3 participants