You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/11 17:05:18 UTC

[PR] fix(clients): reset column filters when the nameserver changes [rocketmq-dashboard]

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: `billing-svc-0@10.0.3.10: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('billing-svc-0@10.0.3.10: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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(clients): reset column filters when the nameserver changes [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #4240:
URL: https://github.com/apache/rocketmq-dashboard/pull/4240


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(clients): reset column filters when the nameserver changes [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #4240:
URL: https://github.com/apache/rocketmq-dashboard/pull/4240#issuecomment-5637954275

   ## Verification evidence
   
   **CI**: This PR's head SHA `64df3418c9a43c38c4d7190cc95d63140a43b831` has exactly one workflow run — "CI" (pull_request), run id 34625707099, conclusion `startup_failure`; check-runs API returns 0. The upstream workflow has been failing at startup for all PRs in this repository (including every recently merged one), so no CI signal is available; all verification below was run locally.
   
   **Red-light actual output** (before the fix, `npx vitest run src/pages/cluster/__tests__/ClientsPage.test.tsx -t "clears column filters when the nameserver changes"`):
   
   ```
   ❯ src/pages/cluster/__tests__/ClientsPage.test.tsx:521:25
       expect(await screen.findByText('billing-svc-0@10.0.3.10:49155')).t…
          |                         ^
   Test Files  1 failed (1)
   Tests  1 failed | 19 skipped (20)
   ```
   
   The row for the new endpoint's Producer connection never rendered because the stale Consumer column filter from the previous endpoint still applied.
   
   **Module tests**: after the fix, `npx vitest run src/pages/cluster/__tests__/ClientsPage.test.tsx` → `Tests 20 passed (20)` (19 pre-existing + 1 new), including the pre-existing `applies table column filters to the exported CSV` and both stale-response guard tests, which pin the behavior this change must not break.
   
   **Full suite + baseline**: `npx vitest run` on this branch → `Test Files 3 failed | 117 passed (120)`, `Tests 4 failed | 978 passed (982)`. The 4 failures are MetricsExplorer (1), ClusterPage (1), ConsumerPage (2) — none of these files is touched by this PR (numstat below). Re-running the three failed files in isolation: `Tests 81 passed (81)`, confirming they are the parallel-load flakiness recorded for these exact files in previous rounds' baselines, not regressions introduced here.
   
   **Build**: `npm run build` → exit 0 (`✓ built in 10.59s`); `npx tsc --noEmit` clean; `npx eslint` on both changed files clean. (One intermediate build failure during development was in the new test's own mock typing and was fixed before commit; the committed tree builds.)
   
   **Diff self-check**: `git show --numstat HEAD` → `57 0 web/src/pages/cluster/__tests__/ClientsPage.test.tsx` and `7 0 web/src/pages/cluster/clients.tsx`; 2 files, +64/−0, no unrelated changes.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org