-
Notifications
You must be signed in to change notification settings - Fork 360
fix(Select): retain selected options during remote searches #3926
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
base: develop
Are you sure you want to change the base?
Conversation
ad40198 to
7d7c91b
Compare
commit: |
11c59cf to
27d6653
Compare
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.
Pull Request Overview
This PR enhances the Select component's remote search functionality by preserving selected options in the value-to-option mapping and triggering initial search on dropdown open. The changes enable the Select component to properly handle remote search scenarios where options are dynamically fetched.
- Preserves selected options in mapping to prevent state loss during remote searches
- Triggers search on dropdown open when search handler exists and input is empty
- Updates remote-search example to demonstrate both single and multiple select modes with loading states
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/components/select/hooks/useOptions.ts | Adds logic to merge previous selected options into the value-to-option mapping and exports helper function for value selection checking |
| packages/components/select/base/Select.tsx | Calls onSearch with empty string when dropdown opens for remote search initialization |
| packages/components/select/_example/remote-search.tsx | Rewrites example to showcase both single and multiple select with proper remote search implementation |
| test/snap/snapshots/ssr.test.jsx.snap | Updates SSR snapshot to reflect new example structure with Space component |
| test/snap/snapshots/csr.test.jsx.snap | Updates CSR snapshot to reflect new example structure with loading states |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
📝 更新日志
fix(Select): 修复在选中选项后,输入框被清空但未触发对应的
onSearch回调问题fix(Select): 修复开启
onSearch与multiple时,选中选项丢失的问题本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单