feat: add SearchSelect component with sync and async support - #3752
Conversation
|
Warning Review limit reached
More reviews will be available in 4 minutes and 21 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
88ab961 to
45fa77b
Compare
0454568 to
b636d08
Compare
45fa77b to
92fb78c
Compare
92fb78c to
181c2ae
Compare
b636d08 to
05d8a2f
Compare
181c2ae to
1f01017
Compare
05d8a2f to
1b6f765
Compare
SearchSelect component with sync and async support
1b6f765 to
e02f244
Compare
1f01017 to
72c07b4
Compare
Confidence Score: 4/5Safe to merge after addressing the double search-clear callback and the cmdk item identity collision. The double-clear bug means async consumers receive onSearchChange("") twice on every close, potentially firing two server requests and confusing debounced handlers. The value={option.label} issue means any dataset with non-unique labels will silently drop options from the list. Both are correctable in-place before the component is wired to real data. ui/components/ui/searchSelect.tsx — the only changed file; both issues are confined to it. Important Files Changed
Reviews (4): Last reviewed commit: "feat: searchSelect component" | Re-trigger Greptile |
f6486ca to
051f5c7
Compare
8991c33 to
7f82c60
Compare
051f5c7 to
7703dab
Compare
7f82c60 to
1b4ba73
Compare
7703dab to
2ace481
Compare
Merge activity
|
The base branch was changed.
## Summary Introduces a new reusable `SearchSelect` component that renders a popover-based search input with a filterable list of selectable options. It supports both synchronous (client-side filtered) and asynchronous (server-driven search) modes. ## Changes - Added `SearchSelect` component built on top of `cmdk` and the existing `Popover`, `Skeleton`, and utility primitives. - Supports controlled and uncontrolled open state via optional `open`/`onOpenChange` props. - Async mode exposes `onSearchChange`, `isSearching`, `isLoading`, `isError`, and `errorMessage` props; when async, the `cmdk` filter is bypassed so results are fully controlled externally. - Provides a default entry view rendering a label, optional description, and a `Plus` icon, with an `entryView` render prop for custom item rendering. - Loading state renders skeleton placeholders; error state renders a destructive message; empty state uses `CommandPrimitive.Empty`. - Accepts a `footer` slot rendered below the list, separated by a border. - Exported `SearchSelect`, `SearchSelectOption`, and `SearchSelectProps` types for external use. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test ```sh cd ui pnpm i || npm i pnpm build || npm run build ``` Render the component with a static options array and verify: 1. The popover opens on trigger click and the search input is auto-focused. 2. Typing filters the list (sync mode). 3. Selecting an item calls `onValueSelect` with the correct option object. 4. In async mode, `onSearchChange` is called on input and loading/error/empty states render correctly. ## Screenshots/Recordings _Add before/after screenshots or a short clip demonstrating the component in use._ ## Breaking changes - [ ] Yes - [x] No ## Related issues _Link related issues and discussions._ ## Security considerations No auth, secrets, or PII involved. Options and search values are UI-local. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [ ] I added/updated tests where appropriate - [ ] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
Introduces a new reusable
SearchSelectcomponent that renders a popover-based search input with a filterable list of selectable options. It supports both synchronous (client-side filtered) and asynchronous (server-driven search) modes.Changes
SearchSelectcomponent built on top ofcmdkand the existingPopover,Skeleton, and utility primitives.open/onOpenChangeprops.onSearchChange,isSearching,isLoading,isError, anderrorMessageprops; when async, thecmdkfilter is bypassed so results are fully controlled externally.Plusicon, with anentryViewrender prop for custom item rendering.CommandPrimitive.Empty.footerslot rendered below the list, separated by a border.SearchSelect,SearchSelectOption, andSearchSelectPropstypes for external use.Type of change
Affected areas
How to test
Render the component with a static options array and verify:
onValueSelectwith the correct option object.onSearchChangeis called on input and loading/error/empty states render correctly.Screenshots/Recordings
Add before/after screenshots or a short clip demonstrating the component in use.
Breaking changes
Related issues
Link related issues and discussions.
Security considerations
No auth, secrets, or PII involved. Options and search values are UI-local.
Checklist
docs/contributing/README.mdand followed the guidelines