Skip to content

fix(select): exclude null-valued options from "Select all" count#42220

Open
gaurav0107 wants to merge 2 commits into
apache:masterfrom
gaurav0107:fix/40228-select-all-in-a-dashboard-filter-incorre
Open

fix(select): exclude null-valued options from "Select all" count#42220
gaurav0107 wants to merge 2 commits into
apache:masterfrom
gaurav0107:fix/40228-select-all-in-a-dashboard-filter-incorre

Conversation

@gaurav0107

Copy link
Copy Markdown

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

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
@gaurav0107
gaurav0107 marked this pull request as ready for review July 19, 2026 21:00
@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Jul 19, 2026
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.19%. Comparing base (36dbff0) to head (24095fd).
⚠️ Report is 1 commits behind head on master.

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           
Flag Coverage Δ
javascript 70.83% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Review Failed - Technical Failure Bito encountered technical difficulties while starting a code review session. To retry, type /review in a comment and save. If the issue persists, contact support@bito.ai.

@rusackas

Copy link
Copy Markdown
Member

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.

@bito-code-review

bito-code-review Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1a1640

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: c9f3696..24095fd
    • superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@sadpandajoe
sadpandajoe requested a review from msyavuz July 20, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend packages size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select All in a dashboard filter incorrectly displays how many values it is selecting if there are null values

2 participants