fix(components): make MiniBar and MiniLine tolerate malformed series data - #2929
Open
yyqdbngt wants to merge 1 commit into
Open
fix(components): make MiniBar and MiniLine tolerate malformed series data#2929yyqdbngt wants to merge 1 commit into
yyqdbngt wants to merge 1 commit into
Conversation
RockteMQ-AI
approved these changes
Sep 1, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Makes MiniBar and MiniLine tolerate malformed series data by filtering non-array inputs and non-finite values. Solid defensive fix — prevents NaN/Infinity from poisoning chart rendering.
Findings
- [Info]
MiniBar.tsx:27— TheNumber.isFinitefilter is the correct guard; alternativelyNumber.isNaN+ explicit Infinity check would also work butisFiniteis cleaner.
Suggestions
No blocking issues. Good test coverage for edge cases.
Automated review by github-manager-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MiniBarandMiniLinenow tolerate non-arraydataprops (rendered as empty / nothing) and drop non-finite elements (NaN/Infinity) before scalingMath.max(...data, 1)/Math.min(...data, 0)spreads with loops so a very large series cannot hit the call-argument limitMiniBar.test.tsx(non-array data, NaN elements) and a newMiniLine.test.tsx(non-array data, <2 finite values, NaN excluded from the path)Why
Both shared mini-chart components read
data.lengthand spreaddataintoMath.max/Math.minwithout validating the array. A non-array payload (e.g.null/undefinedfrom a malformed wire response) crashed the whole component tree atdata.length, and a singleNaNelement poisonedmax/min, producingNaNpxbar heights /NaNSVG path coordinates that silently broke the chart. The dashboard trend column passes the rawthroughputarray 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