unbridled-41 opened a new pull request, #4616:
URL: https://github.com/apache/rocketmq-dashboard/pull/4616
Fixes #4610.
## Problem / Evidence
Two server-paginated tables carry client-side `sorter` callbacks:
- **Audit records** (`web/src/pages/ops/audit.tsx:316-406`, base d50ffecc):
six sorters; the time column sets `defaultSortOrder: 'descend'`. The table uses
controlled pagination (`current/pageSize/total` from the server), and the
server query has a fixed `ORDER BY gmt_create, id DESC`
(`MybatisPlusAuditRepository.java:64`). `listAuditRecords` accepts no sort
parameters.
- **Alert rules** (`web/src/pages/ops/alerts.tsx:647-697`): six sorters on a
table with `pagination={false}` plus an external `Pagination` bound to the
server `totalRules`.
Clicking a header re-orders only the ~20 visible rows while the active sort
arrow implies the whole result was sorted; with `total: 41` an operator reading
"按操作人排序" sees an ordering of page 1 that silently excludes the other 21+
records. The audit time column's default arrow additionally claims a sort state
before the user touches anything.
## Root cause / Fix
Client-side sorting cannot deliver a global order for a server-paginated
table, and the list APIs expose no sort parameters (adding them is a contract
change). The minimal honest fix is to remove the client sorters — including the
`defaultSortOrder` on the audit time column, replaced by `sorter: false` plus a
comment — so the header no longer advertises a sort it cannot honour. The
server's `gmt_create DESC` remains the single documented order. (Wire-format
server-side sorting is the fuller alternative and is noted in the issue for
maintainers.)
## Priority & scoring
PRIORITY 62 = 影响 22 (audit triage decisions: earliest failure, per-operator
grouping) + 波及 8 (two tables, one pattern) + 可复现 20 (deterministic, no race) +
维护价值 12. FIX_CONFIDENCE 90: pure removal of misleading affordances, server
order untouched, all existing tests pass unchanged.
## Tests
```
cd web && npx vitest run src/pages/ops/__tests__/AuditPage.test.tsx
```
- Red (fix stashed, test present): `AssertionError: expected <div…> to be
null` — the time column still rendered `.ant-table-column-sorters` on master.
- Green: AuditPage **11 passed (11)** incl. the new regression (headers
render no sorter affordance and the server row order is preserved); AlertsPage
**26 passed (26)** (its six sorters removed, no test depended on them).
- `npx tsc -b`: clean. `npx eslint` on the three touched files: 0 errors (5
warnings all pre-existing on untouched lines — verified against the stashed
pristine files).
- `npm run build`: ✓ built in 8.27s.
## Risk
Low. No data, API, or query changes; only header affordances are removed.
Users who previously "sorted" were seeing page-local orderings anyway — the
removal makes the UI state truthful. Operators who need a different order can
use the existing filters/search, which are server-side.
--
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]