unbridled-41 opened a new pull request, #4240:
URL: https://github.com/apache/rocketmq-dashboard/pull/4240

   Fixes #4238.
   
   ## Problem / Evidence
   
   On the Client Connections page, switching the NameServer endpoint keeps the 
previous endpoint's table column filters active. `handleNameserverChange` 
(`web/src/pages/cluster/clients.tsx`) resets `currentPage`, `selectedEndpoint`, 
`connections`, `clusterFilter`, and the selected row — but not `columnFilters`, 
and the clusterName/type/protocol/language columns declare uncontrolled 
`filters` + `onFilter` with no `filteredValue`, so antd's internal filter 
selection survives the `dataSource` swap.
   
   Concrete trigger: on NameServer A filter the type column to `Consumer`, then 
switch the NameServer select to an endpoint whose rows are all `Producer` with 
different cluster names. After the load finishes the table renders no rows and 
the stats header reports 0 connections even though the endpoint's data was 
fetched, and the Export button stays disabled (`exportConnections.length === 
0`). Reproduced deterministically by the new regression test, which failed 
before the fix: `[email protected]:49155` was never rendered after the 
switch.
   
   ## Root cause / Fix
   
   Two halves, both required:
   
   1. `handleNameserverChange` now calls `setColumnFilters({})` — the export 
mirror and the controlled column values reset with the endpoint.
   2. The four filterable columns now pass `filteredValue: columnFilters.<key> 
?? null`, making antd's filter state fully controlled. Resetting only our state 
without `filteredValue` would leave antd's internal filter state (and its 
trigger highlight) untouched, which is exactly the stale half of the bug.
   
   ## Priority & scoring
   
   PRIORITY 78 = impact 30 (silently hides real data and permanently disables 
export on a core inventory page) + blast radius 14 (all four filterable columns 
and both the list and export paths) + reproducibility 18 (deterministic UI 
path, no timing) + maintenance value 16 (endpoint-scoped state invalidation, 
the same principle the cluster pages' request guards follow). FIX_CONFIDENCE 
88: the state mismatch is exact and both fix halves were verified against 
antd's controlled-filter semantics by the regression test.
   
   ## Tests
   
   - New regression: `clears column filters when the nameserver changes` 
(`web/src/pages/cluster/__tests__/ClientsPage.test.tsx`) — applies a Consumer 
column filter, switches NameServer, asserts the new endpoint's Producer row 
renders and the exported CSV contains it. **Red before the fix** 
(`findByText('[email protected]:49155')` timed out), **green after**.
   - `npx vitest run src/pages/cluster/__tests__/ClientsPage.test.tsx` → 
**20/20 passed** (19 pre-existing + 1 new).
   - Full web suite `npx vitest run` on this branch: **982 tests, 4 failures** 
in MetricsExplorer (1), ClusterPage (1), ConsumerPage (2) — none of these files 
is touched by this PR. All three files re-run in isolation: **81/81 passed**, 
confirming the full-suite failures are the pre-existing parallel-load flakiness 
recorded in the repo's test baselines, not regressions.
   - `npx tsc --noEmit` clean; `npx eslint` on both changed files clean; `npm 
run build` succeeds.
   
   ## Risk
   
   Low. The only behavior change is that column filters no longer outlive the 
endpoint that produced them; within a single endpoint, filtering, export 
mirroring, and pagination behave exactly as before (the controlled 
`filteredValue` is initialized from the same state the `onChange` handler 
already wrote). antd receives `null` instead of `undefined` when no filter is 
selected, which is its documented "no filter applied" value.
   


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

Reply via email to