gaurav0107 opened a new pull request, #42220:
URL: https://github.com/apache/superset/pull/42220
### SUMMARY
In a multi-select (used by dashboard native filters), the **"Select all
(N)"**
badge counted every visible option, but `handleSelectAll` skips options whose
value is falsy — e.g. the `<NULL>` option (`value: null`). The result: the
badge
could 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.value` truthiness guard that `handleSelectAll`
already 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. The `deselectable`
branch is deliberately left as-is because `handleDeselectAll` does clear a
selected null option, so it must keep counting it.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: options `[Alpha, Bravo, <NULL>]` → badge shows **"Select all (3)"**,
but
clicking it selects only `Alpha` and `Bravo` (2 values).
After: the same options → badge shows **"Select all (2)"**, matching the two
values that Select All actually selects.
### TESTING INSTRUCTIONS
1. Create a dashboard filter (or any multi-select) on a column that contains
`NULL` values so the dropdown includes a `<NULL>` option.
2. Open the dropdown and note the **"Select all (N)"** count.
- Before this change: N includes the `<NULL>` option, but clicking Select
All
selects one fewer value.
- After this change: N excludes the `<NULL>` option and matches the
number of
values 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 on `master`
(badge renders `(3)`) and passes with this change. Run it with:
```
cd superset-frontend
npm run test --
packages/superset-ui-core/src/components/Select/Select.test.tsx
```
All 85 tests in that suite pass.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #40228
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]