fix(select): exclude null-valued options from "Select all" count#42220
fix(select): exclude null-valued options from "Select all" count#42220gaurav0107 wants to merge 2 commits into
Conversation
The multi-select "Select all (N)" badge counted every visible option, but handleSelectAll skips options with a falsy value (e.g. the <NULL> option whose value is null). As a result the badge could read "Select all (3)" while clicking it only selected the two real values, overstating what Select All does. Align the bulkSelectCounts.selectable accumulator with handleSelectAll by applying the same option.value guard, so the count reflects the options that are actually bulk-selectable. Selection behavior is unchanged; only the misleading count is corrected. The deselectable branch is left as-is because handleDeselectAll does clear a selected null option. Fixes apache#40228
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42220 +/- ##
=======================================
Coverage 65.19% 65.19%
=======================================
Files 2768 2768
Lines 156081 156081
Branches 35719 35720 +1
=======================================
Hits 101754 101754
Misses 52365 52365
Partials 1962 1962
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Bito Review Failed - Technical Failure Bito encountered technical difficulties while starting a code review session. To retry, type |
|
Thanks for tackling this... updating the branch to see if CI clears, but let me know if it fails and you want help getting things to pass. |
Code Review Agent Run #1a1640Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
In a multi-select (used by dashboard native filters), the "Select all (N)"
badge counted every visible option, but
handleSelectAllskips options whosevalue is falsy — e.g. the
<NULL>option (value: null). The result: the badgecould read "Select all (3)" while clicking it only selected the two real
values, overstating what Select All actually does (reported in #40228).
The count is computed in
bulkSelectCounts.selectable(
superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx),which omitted the
option.valuetruthiness guard thathandleSelectAllalready applies. This change adds the same guard so the count reflects the
options that are actually bulk-selectable.
Selection behavior is intentionally unchanged — Select All still does not
select
<NULL>; only the misleading count is corrected. Thedeselectablebranch is deliberately left as-is because
handleDeselectAlldoes clear aselected null option, so it must keep counting it.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: options
[Alpha, Bravo, <NULL>]→ badge shows "Select all (3)", butclicking it selects only
AlphaandBravo(2 values).After: the same options → badge shows "Select all (2)", matching the two
values that Select All actually selects.
TESTING INSTRUCTIONS
NULLvalues so the dropdown includes a<NULL>option.<NULL>option, but clicking Select Allselects one fewer value.
<NULL>option and matches the number ofvalues actually selected.
Automated coverage: a regression test was added to
superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx(
"Select all" does not count null-valued options). It fails onmaster(badge renders
(3)) and passes with this change. Run it with:All 85 tests in that suite pass.
ADDITIONAL INFORMATION