-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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(SelectControl): select zero value #26353
fix(SelectControl): select zero value #26353
Conversation
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #26353 +/- ##
=======================================
Coverage 69.17% 69.17%
=======================================
Files 1945 1945
Lines 75979 75979
Branches 8476 8476
=======================================
Hits 52562 52562
Misses 21227 21227
Partials 2190 2190
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Great catch! I would have asked if you could add a test, but I see this is one of those old non-TS pieces of code that likely doesn't have good tests to begin with. So LGTM.
@rekilina I didn't have my laptop handy yesterday, but I noticed now that there's |
@rekilina I'll go ahead and merge this one and follow up with a test PR, as the test suite is arguably pretty messy in its current state. But if you want to add the test, let me know by tagging me here so I can avoid opening a new PR for it. |
(cherry picked from commit a0f0f69)
(cherry picked from commit a0f0f69)
(cherry picked from commit a0f0f69)
SUMMARY
If SelectControl has options with numeric values, then the value 0 can be selected.
In this case, if defaultValue is not set or it is set to undefined, then currentValue will be set to undefined instead of 0.
This fix allows correctly save SelectControl with selected option, which value equals to 0, when the default value is undefined.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
[[0, "label_1"], [1, "label_2"]]
Don't specify default value or set default value to undefined.
ADDITIONAL INFORMATION