Skip to content

Conversation

@zombieJ
Copy link
Member

@zombieJ zombieJ commented Oct 17, 2025

Summary by CodeRabbit

发布说明

  • Bug Fixes

    • 改进了多选下拉框占位符的垂直居中对齐。
  • Chores

    • 更新了依赖版本。
    • 调整了测试配置。
  • Refactor

    • 优化了占位符显示的内部逻辑,提升代码可维护性。

@vercel
Copy link

vercel bot commented Oct 17, 2025

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

Project Deployment Preview Comments Updated (UTC)
select Ready Ready Preview Comment Oct 17, 2025 8:57am

@gemini-code-assist
Copy link

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 refactors the rendering of the placeholder text within the multiple select input component. By integrating the Placeholder component directly into the rc-overflow component's prefix prop, the change simplifies the component structure and improves the conditional display logic for the placeholder. This also includes minor styling adjustments for the placeholder and an update to a related dependency.

Highlights

  • Placeholder Integration: The Placeholder component is now rendered as a prefix within the Overflow component in MultipleContent.tsx, streamlining its display logic and removing the need for a separate show prop.
  • CSS Positioning: New CSS rules were added to patch.less to absolutely position the select-placeholder element, ensuring correct vertical alignment within its container.
  • Dependency Update: The rc-overflow package was updated to version 1.5.0 in package.json, likely to support the new prefix prop usage.
  • Test Adjustment: A test in Multiple.test.tsx was modified to check for the absence of the placeholder element when the select is open, reflecting the new rendering approach where it's conditionally rendered or not present.
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Caution

Review failed

The pull request is closed.

走查

本次变更重构了多选组件中占位符的渲染方式,将其从独立组件改为 Overflow 组件的前缀属性,并调整了占位符的显示逻辑。同时更新了 Jest 配置、升级了依赖,以及修改了相关测试断言以匹配新的 DOM 结构。

变更

内聚/文件 变更摘要
样式和配置更新
assets/patch.less, jest.config.js, package.json
添加多选占位符的垂直居中 CSS 定位;移除 Jest 配置中的 collectCoverage: true 属性;升级 rc-overflow 依赖版本从 ^1.4.0 到 ^1.5.0
占位符渲染重构
src/SelectInput/Content/MultipleContent.tsx, src/SelectInput/Content/Placeholder.tsx
MultipleContent 中的占位符改为通过 Overflow 的 prefix 属性条件渲染;Placeholder 中 show 属性改为可选且默认值为 true;移除外层 Fragment 包装,简化组件结构
测试更新
tests/Multiple.test.tsx
将占位符可见性断言从 CSS 样式检查(visibility: hidden)改为元素存在性检查(占位符元素为 falsy)

序列图

sequenceDiagram
    participant User as 用户交互
    participant MC as MultipleContent
    participant OF as Overflow
    participant PH as Placeholder
    
    rect rgb(200, 220, 255)
    Note over MC,OF: 旧流程
    User->>MC: 渲染多选
    MC->>PH: 独立渲染 Placeholder
    MC->>OF: 渲染 Overflow (无 prefix)
    PH-->>MC: 返回占位符 DOM
    end
    
    rect rgb(220, 255, 220)
    Note over MC,OF: 新流程
    User->>MC: 渲染多选
    alt 无显示值 && (无搜索值 || 未打开)
        MC->>OF: 渲染 Overflow (prefix=Placeholder)
        OF->>PH: 条件创建占位符
        PH-->>OF: 返回占位符 DOM
    else 有显示值或其他条件
        MC->>OF: 渲染 Overflow (无 prefix)
    end
    end
Loading

代码审查工作量估计

🎯 3 (中等) | ⏱️ ~25 分钟

变更涉及组件渲染逻辑重构和相关测试更新,需要理解新的占位符条件渲染模式、验证 Overflow prefix 集成的正确性,以及确认测试断言与新 DOM 结构相符。配置和依赖变更相对简单,但需核实其与功能变更的兼容性。

🐰 占位符换新装,从容器到前缀流转,
条件渲染巧安排,简化结构更清爽,
测试随之齐步进,依赖升级助前行,
层级精简,逻辑优雅,草地上欢快蹦跳!✨

✨ 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 placeholder

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1772ffa and 6b5bd9a.

📒 Files selected for processing (6)
  • assets/patch.less (1 hunks)
  • jest.config.js (0 hunks)
  • package.json (1 hunks)
  • src/SelectInput/Content/MultipleContent.tsx (1 hunks)
  • src/SelectInput/Content/Placeholder.tsx (1 hunks)
  • tests/Multiple.test.tsx (1 hunks)

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 Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.41%. Comparing base (1772ffa) to head (6b5bd9a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1167      +/-   ##
==========================================
- Coverage   99.49%   99.41%   -0.09%     
==========================================
  Files          31       31              
  Lines        1191     1191              
  Branches      399      400       +1     
==========================================
- Hits         1185     1184       -1     
- Misses          6        7       +1     

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

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 refactors the placeholder logic for multiple select mode by moving the Placeholder component into the prefix prop of the Overflow component. This is a good structural improvement. The related changes in CSS, dependencies, and tests are all consistent with this refactoring. I have one suggestion to improve the separation of concerns by removing a redundant check, which will make the code easier to maintain.

</>
<Overflow
prefixCls={`${prefixCls}-content`}
prefix={!displayValues.length && (!searchValue || !triggerOpen) ? <Placeholder /> : null}

Choose a reason for hiding this comment

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

medium

The condition to render the Placeholder includes !displayValues.length. However, the Placeholder component itself already contains logic to return null if displayValues is not empty. This creates redundant logic and couples the components unnecessarily.

To improve separation of concerns, you can remove the !displayValues.length check from here and let the Placeholder component be solely responsible for determining its visibility based on displayValues.

Suggested change
prefix={!displayValues.length && (!searchValue || !triggerOpen) ? <Placeholder /> : null}
prefix={(!searchValue || !triggerOpen) ? <Placeholder /> : null}

@zombieJ zombieJ merged commit c3c2678 into master Oct 17, 2025
10 of 12 checks passed
@zombieJ zombieJ deleted the placeholder branch October 17, 2025 08:59
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.

2 participants