messere1 commented on PR #6137: URL: https://github.com/apache/rocketmq-dashboard/pull/6137#issuecomment-6129510439
Thanks @lizhimins for the deep verification — the `List<Integer>` / no-delta-computation analysis is exactly the correction this needed, and the prescription was straightforward to follow. Reworked in c0232b01, point by point: 1. **Shared helper** — `finiteNumber`/`nonNegativeNumber` now live in `web/src/utils/chartSamples.ts`; `dashboardTrafficInsights.ts` consumes the shared rule instead of its private copy, with its public API unchanged (its existing tests are untouched and green). 2. **Family consistency** — both `MiniBar` and `MiniLine` consume the shared helper, so the identical `Math.max(...data, 1)` pattern is sanitized in both. `MiniLine` gets a new mutation-sensitive test: the path for `[-5, NaN, Infinity, 10]` must equal its zero-clamped reference `[0, 0, 0, 10]` with no `NaN` coordinates — it fails on the unpatched component. 3. **Reflow dropped** — the empty-state `<span>` is back to the original formatting. (For the record: that reflow was almost certainly our pre-commit lint-staged `prettier --write`, not a hand edit; since CI does not gate on prettier, the trunk formatting stands as requested.) 4. **Motivation restated** — the PR description now frames this as defense-in-depth for a shared chart component and explicitly states the only production caller feeds a server-side `List<Integer>` that cannot be NaN/negative; it is family-consistency hardening, not a live bug fix. Title updated to `refactor(web): share sample sanitization across the chart family` to match. Full check on the reworked tip: 21/21 tests green across MiniBar / MiniLine / dashboardTrafficInsights / the insights page test, eslint clean, `tsc -b` clean. -- 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]
