-
Notifications
You must be signed in to change notification settings - Fork 199
feat: combine search props #646
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
feat: combine search props #646
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
""" Walkthrough本次变更对 TreeSelect 组件的搜索相关 API 进行了重构。引入了新的 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TreeSelect
participant useSearchConfig
participant BaseSelect
User->>TreeSelect: 传入 showSearch (布尔/对象) 及/或旧搜索属性
TreeSelect->>useSearchConfig: 合并 showSearch 和旧属性
useSearchConfig-->>TreeSelect: 返回 mergedShowSearch, searchConfig
TreeSelect->>BaseSelect: 传递 mergedShowSearch, searchConfig
User->>TreeSelect: 输入搜索内容
TreeSelect->>BaseSelect: 触发 onSearch、过滤树节点等逻辑
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
tests/Select.spec.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct. The config "prettier" was referenced from the config file in "/.eslintrc.js". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate Unit Tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 2
🧹 Nitpick comments (2)
tests/Select.spec.tsx (1)
713-838
: 测试用例操作未使用act
,可能产生异步警告在
fireEvent.change
后组件内部会触发setState
,React Testing Library 建议包裹在act
中,以避免 “state update on unmounted component” 之类的异步告警。虽然当前 CI 可能未报错,但长期来看易埋隐患。-import { render, fireEvent } from '@testing-library/react'; +import { render, fireEvent, act } from '@testing-library/react'; ... - fireEvent.change(legacyInput, { target: { value: '2' } }); - fireEvent.change(currentInput, { target: { value: '2' } }); + await act(async () => { + fireEvent.change(legacyInput, { target: { value: '2' } }); + fireEvent.change(currentInput, { target: { value: '2' } }); + });src/TreeSelect.tsx (1)
746-749
:searchConfig
展开顺序可能掩盖配置
{...searchConfig}
位于searchValue
、onSearch
之前,后两者会覆盖同名字段。当前实现依赖这种覆盖逻辑,但可读性较弱,后续维护者易误调顺序导致行为变化。
建议显式剔除searchValue
、onSearch
后再展开,或增加注释说明覆盖意图。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/TreeSelect.tsx
(6 hunks)src/hooks/useSearchConfig.ts
(1 hunks)tests/Select.spec.tsx
(2 hunks)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #646 +/- ##
=======================================
Coverage 99.83% 99.83%
=======================================
Files 16 17 +1
Lines 593 602 +9
Branches 184 186 +2
=======================================
+ Hits 592 601 +9
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
ant-design/ant-design#33482
FRC: ant-design/ant-design#53978
Summary by CodeRabbit
新功能
重构
测试