yyqdbngt opened a new pull request, #2875: URL: https://github.com/apache/rocketmq-dashboard/pull/2875
## Summary - Consolidate dashboard number rendering into an exported `renderCount()` helper: null/undefined/NaN become the existing `N/A` placeholder, and formatting uses a stable `en-US` locale (same convention as `formatNumber` in `utils/format.ts`) - Apply it to the broker/proxy/TPS-in/TPS-out table columns and the TPS-out stat card detail - Guard the "million messages" stat detail against a non-finite `totalMessagesToday` (renders `0` instead of `NaN`) - Pass a guaranteed array to `MiniBar` when a cluster row omits `throughput` - Add regression tests: a cluster with null TPS values and a missing throughput series renders without crashing, plus unit tests for `renderCount` ## Why Dashboard data comes from the backend over JSON, so field shapes are not guaranteed even when the TypeScript type says otherwise. Two crash/leak paths: `v.toLocaleString()` on the TPS columns throws for a `null` value taken from the wire, and `MiniBar` reads `data.length`, so a cluster row missing `throughput` crashed the whole dashboard page (no error boundary). The unqualified `toLocaleString()` calls additionally produced locale-dependent separators that varied with the viewer's browser locale, inconsistent with the rest of the app's stable formatting. ## Testing - `./node_modules/.bin/vitest run src/pages/home/` → 12 passed (2 new) - `./node_modules/.bin/tsc --noEmit` → clean - `./node_modules/.bin/eslint src/pages/home/dashboard.tsx src/pages/home/__tests__/DashboardPage.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]
