apache / apache/rocketmq-dashboard

[Studio][Bug] Switching between cluster and business alert rules reuses the previous page's filters and pagination

Open
#4,008 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

Navigating between the two alert-rule pages (告警规则 `/ops/alerts` ↔ 业务告警规则 `/ops/business-alerts`) reuses the previous page's pagination, search and status filter, producing an empty or silently narrowed rule list on the destination page.

## Evidence

Both routes render the same `AlertsPage` component without a key (`web/src/App.tsx:187-188`), so React Router preserves the component instance — and its state — across navigation between the two primary menu entries (`web/src/layouts/MainLayout.tsx:204,218`). `page`, `search` and `enabledFilter` (`web/src/pages/ops/alerts.tsx:159-162`) are never reset when the `domain` prop changes; the list effect re-fetches with the retained values.

Reproduction (deterministic): on 告警规则, page to page 2 with 21+ rules (or type a search term), then click 业务告警规则. The business list is fetched with `page: 2` and the retained search; out-of-range pages slice to `items: []` with `total` unchanged, so the table is empty while the pagination control clamps its displayed page to 1 — it looks like no business rules exist. A retained search silently narrows the other domain's list.

## Impact

A primary navigation path shows an empty or filtered rule list that does not correspond to the destination page's own filters; operators can conclude that business rules are missing.

## Expected behavior

Switching domains loads the destination domain from a clean state: page 1, no search, no status filter, no stale row selection.

## Related work

#2430 (closed) reset inventory pagination when filters shrink results on the same page family; the domain switch is the remaining path that leaves stale list state. #2570/#2589 cover different create/pagination defects.

## PR

#4004

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in web/src/App.tsx and web/src/pages/ops/alerts.tsx, then review the route entries in web/src/layouts/MainLayout.tsx. Check how AlertsPage state is retained when its domain prop changes and verify navigation between /ops/alerts and /ops/business-alerts. Done means the destination opens on page 1 with empty search and status filters and no stale row selection; related PR #4004 is already listed.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.