Skip to content

Conversation

@bernardobelchior
Copy link
Member

@bernardobelchior bernardobelchior commented Oct 28, 2025

Fixes #20113.

This is the problematic line. We don't add the event listeners if hasInteractionPlugin, but useChartInteraction is defined after useChartCartesianAxis so hasInteractionPlugin is false on the first render. The fix is to switch their order, which is doable since useChartInteraction doesn't depend on useChartCartesianAxis. I applied this fix to polar charts since they had the same issue.

We didn't catch it because there are at least two things causing re-renders on first render: StrictMode and responsive width, which is why this only manifests when StrictMode is off and width is pre-defined.

Fix confirmation

@bernardobelchior bernardobelchior added type: regression A bug, but worse, it used to behave as expected. scope: charts Changes related to the charts. labels Oct 28, 2025
@mui-bot
Copy link

mui-bot commented Oct 28, 2025

Deploy preview: https://deploy-preview-20115--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 🔺+4B(0.00%)
@mui/x-charts-pro 0B(0.00%) 🔺+6B(0.00%)
@mui/x-charts-premium 0B(0.00%) 🔺+6B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 0191590

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 28, 2025

CodSpeed Performance Report

Merging #20115 will not alter performance

Comparing bernardobelchior:fix-tooltip-hidden-first-render (0191590) with master (f12ce30)1

Summary

✅ 13 untouched

Footnotes

  1. No successful run was found on master (2997f21) during the generation of this report, so f12ce30 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix

@bernardobelchior bernardobelchior merged commit 7e3eead into mui:master Oct 28, 2025
22 checks passed
@bernardobelchior bernardobelchior deleted the fix-tooltip-hidden-first-render branch October 28, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: charts Changes related to the charts. type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[charts] Charts given a numeric width do not render tooltip on first render

4 participants