-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
fix: Duplicated options in Select when using numerical values #24906
fix: Duplicated options in Select when using numerical values #24906
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24906 +/- ##
===========================================
+ Coverage 58.45% 68.84% +10.38%
===========================================
Files 1906 1906
Lines 74141 74144 +3
Branches 8208 8207 -1
===========================================
+ Hits 43337 51041 +7704
+ Misses 28683 20971 -7712
- Partials 2121 2132 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 291 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
/testenv up |
@michael-s-molina Ephemeral environment spinning up at http://34.221.157.238:8080. Credentials are |
@michael-s-molina Have you considered an alternative approach of stringifying the numeric values when using them as option values and then parsing the numbers in onSelect callback? If it's possible, it could save us some added complexity of the features added for parity with tag mode |
expect(options[1]?.textContent).toEqual('CAc'); | ||
expect(options[2]?.textContent).toEqual('abac'); | ||
expect(options[3]?.textContent).toEqual('Cac'); | ||
await waitFor(() => { |
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.
Are all those test changes relevant to the fix or are those just some bycatches?
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.
These changes are the result of debouncing handleOnSearch
.
I did consider this approach but rejected for the following reasons:
|
Got it, thanks for explanation 👍 |
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.
LGTM
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.
Code LGTM. We will run regression testing on this one to catch any possible side effect. Thanks!
Ephemeral environment shutdown and build artifacts deleted. |
(cherry picked from commit b621ee9)
SUMMARY
We noticed that
Select
options were being duplicated when searching for a value in numerical filters. It turns out that Ant Design Select can't have options with numerical values when mode equalstags
. It displays the following warning:Warning: value of Option should not use number type when mode is tags or combobox
To overcome this limitation, this PR changes the mode to
multiple
and implement missing features such as allowing new values and copy and paste.Fixes #24877
TESTING INSTRUCTIONS
I added a test to the component but we need to check the general use of selects in the application because there are wrappers that override the component behavior such as
SelectControl
andSelectFilterPlugin
.ADDITIONAL INFORMATION