Commit 0f3953c
fix(filters): preserve backend metric-based sorting in select filters
Fixes broken metric-based sorting (e.g., sort by MAU) in select filter components
by preventing frontend alphabetical sorting from overriding backend sort order.
Problem:
- When sortMetric was specified in filter configuration, the backend would
correctly sort data by the specified metric (e.g., MAU, revenue, etc.)
- However, the frontend sortComparator was then applying alphabetical sorting
on the labels, completely overriding the intended metric-based order
- This resulted in filters showing values sorted alphabetically instead of
by their actual metric values
Solution:
- Check if formData.sortMetric is specified before applying sort logic
- When sortMetric exists, return 0 to preserve the original backend order
- Only apply alphabetical sorting when no sortMetric is configured
- Add sortMetric to useCallback dependency array for proper re-rendering
This ensures that metric-based sorting (like "sort by MAU") works correctly
while maintaining alphabetical sorting as a fallback for other cases.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 36daa2d commit 0f3953c
File tree
1 file changed
+8
-1
lines changed- superset-frontend/src/filters/components/Select
1 file changed
+8
-1
lines changedLines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
320 | 327 | | |
321 | 328 | | |
322 | 329 | | |
323 | 330 | | |
324 | 331 | | |
325 | 332 | | |
326 | | - | |
| 333 | + | |
327 | 334 | | |
328 | 335 | | |
329 | 336 | | |
| |||
0 commit comments