Anyeling0620 opened a new issue, #6148:
URL: https://github.com/apache/rocketmq-dashboard/issues/6148

   ## 正文
   
   ### Summary
   
   On the **Message** (Topic tab) and **DLQMessage** pages, merely moving the 
mouse over an open
   Begin/End date-time picker corrupts the filter state:
   
   * panel year runs away `2029 → 2031 → 2033 → … → 2065` in one sweep
   * the input ends up showing a bogus time (`2026-10-10` → `2042-11-30`), 
`Esc` does not restore it
   * clicking a cell selects a different date than the one clicked
   * **Search** is then rejected by the page's own validation
     (*"end time should be later than begin time"*) and no request is sent
   
   ### Affected
   
   * Image `apacherocketmq/rocketmq-dashboard:latest`
     (digest 
`sha256:ce78506bd6fe01095bf1b37c954625e363ba5afae5d1539b77f395785d445e33`, = 
tag `2.1.0`)
   * Branch `master_archive` (2.x line) — the same code is there
   * `master` (3.0.0 line) is **not** affected: it already uses dayjs for its 
pickers
   
   ### Steps to reproduce
   
   1. Message → Topic; click the **Begin** date-time field (value e.g. 
`2026-10-10 00:00:00`)
   2. Without clicking anything, move the mouse a few times across the open 
panel
   3. Watch the panel year run away; press `Esc` and check the input value
   4. Press **Search** → error toast, no request sent
   
   ### Screenshots (same instance, only the frontend bundle differs)
   
   ![before / 
after](https://raw.githubusercontent.com/Anyeling0620/rocketmq-dashboard/assets/picker-bug/picker-before-after.png)
   
   **Before** — official `2.1.0` image: all 42 calendar cells render as 
selected, panel shows **Feb 2029**
   while the value is `2026-10-10`:
   
   
![before](https://raw.githubusercontent.com/Anyeling0620/rocketmq-dashboard/assets/picker-bug/picker-before.png)
   
   **After** — with the fix: only the current value is selected, the panel 
opens on **Oct 2026**:
   
   
![after](https://raw.githubusercontent.com/Anyeling0620/rocketmq-dashboard/assets/picker-bug/picker-after.png)
   
   ### Root cause
   
   antd v5's `DatePicker` is dayjs-based, and its `generateConfig` helpers 
never clone (dayjs is
   immutable, so `d.year(y)` there returns a new object). These pages pass 
**Moment** objects into
   those pickers (`useState(moment())`), and Moment setters mutate in place — 
so every internal
   rc-picker call (panel navigation, hover preview, time-column hover) rewrites 
the page's own state
   object **without firing `onChange`**, and the picker follows the object it 
was handed.
   
   Instrumented proof on the shipped bundle (no source change): hovering only, 
`state.begin` went
   `2026-10-10 → 2042-11-30`, `onChange` count `0`, object identity unchanged 
(`sameRef === true`).
   
   ### Fix
   
   A fix is proposed in the PR linked to this issue: use dayjs for the states 
that are bound to the
   DatePickers (`Message/message.jsx`, `DLQMessage/dlqmessage.jsx`, 
`Dashboard/DashboardPage.jsx`) —
   `dayjs` is already a dependency. After the fix the values stay stable while 
hovering, the search
   request carries the correct begin/end, and clicking a cell selects exactly 
that date.
   
   ### Workaround (without patching)
   
   Type the datetime directly into the input (`YYYY-MM-DD HH:mm:ss`) and press 
Enter — the query then
   uses exactly the typed 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