unbridled-41 opened a new issue, #4188:
URL: https://github.com/apache/rocketmq-dashboard/issues/4188

   **Problem**
   
   On the home dashboard (`/`, `web/src/pages/home/dashboard.tsx`), the Metrics 
Explorer below the cluster cards keeps its component instance mounted while the 
实例 selector changes (`<MetricsExplorer instanceId={selectedInstanceId} />` with 
no `key`). When the instance prop changes, the profile-loading effect re-runs 
and reloads every panel — but it hardcodes `RANGE_OPTIONS[0]` (the 1h window, 
`web/src/components/MetricsExplorer.tsx:539` before the fix) instead of the 
currently selected range.
   
   **Evidence**
   
   Reproduction (component test, mocked API):
   1. Select a non-default range (e.g. 6h) — the panel issues a query with 
`start = end - 6h`, `step = '2m'`, and the Segmented control shows 6h.
   2. Change the dashboard instance selector (instance-1 → instance-2). The 
profiles effect re-runs (`loadAll` is in its dependency chain through 
`runQuery`, which depends on `instanceId`) and reloads the panels.
   3. Observed with the unfixed code: the reload query uses the default 1h 
window (`start = end - 1h`, `step = '30s'`) while the Segmented control still 
displays **6h**. The charts now show one hour of data for a control that says 
six hours, and the user is not told anything changed.
   
   The same effect runs once on mount, where `RANGE_OPTIONS[0]` is correct; the 
defect is that the value is also used on the *reload* path where a user 
selection already exists.
   
   **Impact**
   
   Every instance switch on the home dashboard silently narrows the explored 
window to 1h for users working with the 6h/24h ranges — the displayed range 
label and the actual data window disagree, so trend readings taken right after 
a switch are quietly wrong.
   
   **Expected behavior**
   
   A reload triggered by an instance change reuses the range the user selected; 
the 1h default applies only before the first selection (initial mount).
   
   **Related work**
   
   - #3304 / PR #3299 fixed the sibling request-guard issue in the same effect 
(shared requestId double-bump); the range-reuse gap remained.
   - No existing issue/PR covers the range reverting on instance switch 
(searched: metrics range, range reset, instance switch, rangeId).
   
   **PR**
   
   Fix: #4180
   


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