rusackas opened a new pull request, #42596:
URL: https://github.com/apache/superset/pull/42596
### SUMMARY
This is a **test-only PR** opened as a TDD-style validation of issue #36775.
#36775 (filed 2026, and a recurrence of #35008) reports that numeric filter
values in the dashboard filter-value dropdown are sorted alphabetically ("1,
10, 100...") instead of numerically ("1, 2, 3..."). Confirmed still present
through 6.0.0, 6.0.1rc1, and 6.1.0rc2 per reporter comments.
Root cause: `SelectFilterPlugin`'s `sortComparator`
(`superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx`)
compares options via `propertyComparator('label')`, but
`getDataRecordFormatter` (`superset-frontend/src/filters/utils.ts`) always
returns a `string` label regardless of the column's underlying datatype. So
numeric filter values always hit `propertyComparator`'s string branch
(`localeCompare`) instead of its numeric branch. This is the second recurrence:
#34858 fixed the analogous bug in `SelectControl.jsx` (chart-builder numeric
selects like "Row limit"), but never touched this native-filter value dropdown,
which has its own independent sorting logic.
This PR adds one regression test on `PluginFilterSelect`:
1. **`sorts numeric filter values numerically, not lexicographically, when
no sortMetric is specified`** — renders the filter with numeric column values
`[10, 2, 100]` and asserts the dropdown options render in ascending numeric
order (`2, 10, 100`), not ascending lexicographic order of their formatted
labels (`10, 100, 2`).
### How to interpret CI
- **CI green** → the sort has been fixed since this was written; merging
closes #36775.
- **CI red** → bug is still live (confirmed locally: the test fails with
options rendering as `10, 100, 2`). Likely fix: give `sortComparator` a
numeric-aware comparator when the underlying column datatype is
`GenericDataType.Numeric`, rather than always comparing the formatted string
label.
### TESTING INSTRUCTIONS
```bash
npx jest src/filters/components/Select/SelectFilterPlugin.test.tsx -t "sorts
numeric filter values numerically"
```
### ADDITIONAL INFORMATION
- [x] Has associated issue: closes #36775
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
**Disclosure:** the local `type-checking-frontend` pre-commit hook was
skipped (`SKIP=type-checking-frontend`) — this worktree lacks the pre-built
`lib/spec/index.d.ts` a from-scratch `tsc -b` needs. All other local hooks
(prettier, oxlint, custom-rules-frontend, stylelint) passed. CI's `type-check`
job is the real gate for this.
🤖 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]