rebenitez1802 opened a new pull request, #43460:
URL: https://github.com/apache/superset/pull/43460

   ### 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:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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](https://claude.com/claude-code)
   


-- 
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]

Reply via email to