[@mantine/charts] LineChart, CompositeChart, BubbleChart: Fix textColor and gridColor props being passed as attributes to the DOM node - #9181
Open
coldsmirk wants to merge 1 commit into
Conversation
…lor` and `gridColor` props being passed as attributes to the DOM node
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes correctly remove the offending props from ...others and add targeted regression tests to prevent the React DOM-attribute warning from returning.
Pull request overview
Fixes React “unrecognized prop” warnings in @mantine/charts by ensuring textColor (and gridColor where applicable) are destructured out of component props so they do not end up in ...others and get spread onto the root DOM element as invalid attributes.
Changes:
- Remove
textColorfromLineChart’s...othersby destructuring it fromprops. - Remove
gridColorandtextColorfromCompositeChartandBubbleChart’s...othersby destructuring them fromprops. - Add regression tests for all three charts to ensure these props do not appear as DOM attributes.
File summaries
| File | Description |
|---|---|
| packages/@mantine/charts/src/LineChart/LineChart.tsx | Destructures textColor to prevent it from being spread to the root element via ...others. |
| packages/@mantine/charts/src/LineChart/LineChart.test.tsx | Adds a regression test asserting textColor/gridColor are not present as DOM attributes. |
| packages/@mantine/charts/src/CompositeChart/CompositeChart.tsx | Destructures gridColor and textColor to prevent invalid DOM attributes on the root element. |
| packages/@mantine/charts/src/CompositeChart/CompositeChart.test.tsx | Adds a regression test asserting textColor/gridColor are not present as DOM attributes. |
| packages/@mantine/charts/src/BubbleChart/BubbleChart.tsx | Destructures gridColor and textColor to prevent invalid DOM attributes on the root element. |
| packages/@mantine/charts/src/BubbleChart/BubbleChart.test.tsx | Adds a regression test asserting textColor/gridColor are not present as DOM attributes. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
textColor(andgridColorinCompositeChartandBubbleChart) is read by the vars resolver but never taken out ofprops, so it stays in...othersand lands on the rootdivas an attribute. React logs this on every render of a chart that sets it:Same thing as #7288 / #7349, which fixed
BarChartin 7.15.2 and 7.15.3, and #7378 forAreaChart.LineChart,CompositeChartandBubbleChartstill have it; every other chart already pulls the two props out before spreading the rest. Ran into it withLineCharton 9.6.0.The fix is the same one-liner as before. I also added a small test to each of the three files that renders with both props and checks the root element does not carry them – it fails on
masterwithout the change.