[fix] Share more code between Selectbox and Multiselect to align behavior#12330
Merged
sfc-gh-bnisco merged 7 commits intodevelopfrom Aug 28, 2025
Merged
[fix] Share more code between Selectbox and Multiselect to align behavior#12330sfc-gh-bnisco merged 7 commits intodevelopfrom
sfc-gh-bnisco merged 7 commits intodevelopfrom
Conversation
Contributor
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates shared logic between Selectbox and Multiselect components to fix a bug and reduce code duplication. The refactoring moves common filtering, validation, and state management logic into shared utilities while maintaining the same functionality for both components.
Key Changes
- Extracts shared filtering and option management logic into
useSelectCommonhook andfuzzyFilterSelectOptionsutility - Refactors both Selectbox and Multiselect to use the shared components
- Adds comprehensive test coverage for the new shared utilities
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/lib/src/util/fuzzyFilterSelectOptions.ts |
New utility function for fuzzy filtering select options with sorting |
frontend/lib/src/util/fuzzyFilterSelectOptions.test.ts |
Unit tests for the fuzzy filtering functionality |
frontend/lib/src/hooks/useSelectCommon.ts |
New hook that encapsulates shared logic between Selectbox and Multiselect |
frontend/lib/src/components/widgets/Multiselect/Multiselect.tsx |
Refactored to use shared utilities, removing duplicated code |
frontend/lib/src/components/widgets/Multiselect/Multiselect.test.tsx |
Added mobile-specific tests for the refactored component |
frontend/lib/src/components/shared/Dropdown/Selectbox.tsx |
Refactored to use shared utilities, removing duplicated filtering logic |
frontend/lib/src/components/shared/Dropdown/Selectbox.test.tsx |
Removed test that was moved to the shared utility test file |
lukasmasuch
reviewed
Aug 28, 2025
2b48d56 to
3b0c689
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
st.selectbox([fix] Selectbox with accept_new_options on mobile shows keyboard #12219), but not inst.multiselect. Ultimately, this is because the code is effectively duplicated between the 2, despite much of the behavior needing to be the same.GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.