Skip to content

fix(native-filters): keep "Select all" count stable while searching the Value filter - #43460

Open
rebenitez1802 wants to merge 1 commit into
apache:masterfrom
rebenitez1802:rebenitez1802/sc-115492-select-all-count-flicker
Open

fix(native-filters): keep "Select all" count stable while searching the Value filter#43460
rebenitez1802 wants to merge 1 commit into
apache:masterfrom
rebenitez1802:rebenitez1802/sc-115492-select-all-count-flicker

Conversation

@rebenitez1802

Copy link
Copy Markdown
Contributor

SUMMARY

In a native Value filter backed by a column with many distinct values, typing a search string narrows the dropdown as expected, but the bulk "Select all (N)" control at the bottom briefly shows the search-scoped count (e.g. Select all (4)) for about a second before reverting to the full-column count (e.g. Select all (73)). Because the number momentarily reflects the search results, users reasonably conclude that search-scoped "Select all" is supported and that the resulting full-column selection is a bug — when in fact selecting the whole column is the intended, correct behavior. Search-scoped bulk selection is not a feature Superset supports.

Root cause: the shared Select component (@superset-ui/core) derives the "Select all (N)" badge from its search-scoped visibleOptions state. On each keystroke visibleOptions is first narrowed by the component's own debounced local filter (→ scoped count), then reset back to the full list once the native filter hands the component a new options array reference (→ full count). The gap between those two updates is the flicker window. There is no stable, search-independent count backing the label.

Fix: add an opt-in stableSelectAll prop to the shared Select. When set (only the native Value filter sets it, gated the same way as the existing allowSelectAll), the bulk count, the button visibility, and the "Select all" / "Clear" actions all operate on the full, search-independent option set instead of visibleOptions. The label is therefore stable while searching and always matches what clicking it actually does (the whole column). Generic Select consumers are unaffected: the prop defaults to false and the off path is byte-for-byte identical to before (verified with a truth-table equivalence of the refactored count predicate).

Notable design points:

  • A shared isBulkSelectable(option) helper (truthy value, not disabled, not a "create new" entry) is used by the count, the visibility gate, and the click handler so they cannot drift.
  • "Select all" and "Clear" stay internally consistent under the gate — the "Clear (N)" count always equals what clicking "Clear" removes, including for <NULL>/falsy-value selections.
  • The full-set memo is gated on stableSelectAll, so consumers that don't use the feature pay no extra cost.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: while typing in a Value filter's search box, "Select all (N)" flickers from the matched-subset count to the full-column count (~1s).

After: "Select all (N)" stays pinned to the full-column count throughout typing, with no intermediate value shown; clicking it selects the whole column, matching the label.

TESTING INSTRUCTIONS

Automated:

  • cd superset-frontend
  • npm run test -- packages/superset-ui-core/src/components/Select/Select.test.tsx src/filters/components/Select/SelectFilterPlugin.test.tsx
  • New unit tests drive fake timers past the search debounce so visibleOptions narrows before asserting; they fail against the unpatched component and pass with the fix.

Manual:

  1. Open a dashboard with a native filter of type Value configured against a column with many distinct values.
  2. Click into the filter's search input and type a partial string that matches a small subset.
  3. Observe the "Select all (N)" control: the count stays at the full column value with no intermediate/flickering value.
  4. Click "Select all" — the entire column is selected, matching the label.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

…he Value filter

The native Value filter's shared Select derived its "Select all (N)" badge from the search-scoped visibleOptions state, so typing a search string briefly showed the matched-subset count before reverting to the full-column count — implying a search-scoped selection that Superset does not support.

Add an opt-in `stableSelectAll` prop (set by the native Value filter) that backs the bulk "Select all"/"Clear" count, visibility, and actions with the full, search-independent option set. Generic Select consumers are unchanged (the prop defaults false and the off path is byte-for-byte identical).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added change:frontend Requires changing the frontend dashboard:native-filters Related to the native filters of the Dashboard labels Aug 24, 2026
@bito-code-review

bito-code-review Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #48a33d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: 9b7e3ce..9b7e3ce
    • superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Select/types.ts
    • superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
    • superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
  • Files skipped - 1
    • UPDATING.md - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.86%. Comparing base (c3ed8b3) to head (9b7e3ce).
⚠️ Report is 38 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43460      +/-   ##
==========================================
- Coverage   78.86%   78.86%   -0.01%     
==========================================
  Files        2876     2876              
  Lines      164601   164613      +12     
  Branches    38015    38025      +10     
==========================================
+ Hits       129806   129815       +9     
- Misses      32348    32351       +3     
  Partials     2447     2447              
Flag Coverage Δ
javascript 74.21% <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.

@rebenitez1802
rebenitez1802 requested a review from rusackas August 24, 2026 20:53
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 dashboard:native-filters Related to the native filters of the Dashboard packages size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant