yyqdbngt opened a new pull request, #2929: URL: https://github.com/apache/rocketmq-dashboard/pull/2929
## Summary - `MiniBar` and `MiniLine` now tolerate non-array `data` props (rendered as empty / nothing) and drop non-finite elements (`NaN`/`Infinity`) before scaling - Replaced `Math.max(...data, 1)` / `Math.min(...data, 0)` spreads with loops so a very large series cannot hit the call-argument limit - Adds regression tests: `MiniBar.test.tsx` (non-array data, NaN elements) and a new `MiniLine.test.tsx` (non-array data, <2 finite values, NaN excluded from the path) ## Why Both shared mini-chart components read `data.length` and spread `data` into `Math.max`/`Math.min` without validating the array. A non-array payload (e.g. `null`/`undefined` from a malformed wire response) crashed the whole component tree at `data.length`, and a single `NaN` element poisoned `max`/`min`, producing `NaNpx` bar heights / `NaN` SVG path coordinates that silently broke the chart. The dashboard trend column passes the raw `throughput` array from the API straight in, so the component itself must be defensive even where a call site adds its own guard. ## Testing - `./node_modules/.bin/vitest run src/components/__tests__/MiniBar.test.tsx src/components/__tests__/MiniLine.test.tsx src/pages/home/__tests__/DashboardPage.test.tsx` → 13 passed (5 new; verified all 5 fail with the pre-fix components) - `./node_modules/.bin/tsc --noEmit` → clean - `./node_modules/.bin/eslint src/components/MiniBar.tsx src/components/MiniLine.tsx src/components/__tests__/MiniBar.test.tsx src/components/__tests__/MiniLine.test.tsx` → 0 errors -- 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]
