fix(native-filters): keep "Select all" count stable while searching the Value filter - #43460
Conversation
…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>
Code Review Agent Run #48a33dActionable 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
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:
|
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
Selectcomponent (@superset-ui/core) derives the "Select all (N)" badge from its search-scopedvisibleOptionsstate. On each keystrokevisibleOptionsis 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 newoptionsarray 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
stableSelectAllprop to the sharedSelect. When set (only the native Value filter sets it, gated the same way as the existingallowSelectAll), the bulk count, the button visibility, and the "Select all" / "Clear" actions all operate on the full, search-independent option set instead ofvisibleOptions. The label is therefore stable while searching and always matches what clicking it actually does (the whole column). GenericSelectconsumers are unaffected: the prop defaults tofalseand the off path is byte-for-byte identical to before (verified with a truth-table equivalence of the refactored count predicate).Notable design points:
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.<NULL>/falsy-value selections.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-frontendnpm run test -- packages/superset-ui-core/src/components/Select/Select.test.tsx src/filters/components/Select/SelectFilterPlugin.test.tsxvisibleOptionsnarrows before asserting; they fail against the unpatched component and pass with the fix.Manual:
ADDITIONAL INFORMATION
🤖 Generated with Claude Code