Skip to content

[charts] Add environment check for warning messages in axis and radar hooks#22506

Merged
sai6855 merged 8 commits into
mui:masterfrom
sai6855:charts-warning-msgs
May 18, 2026
Merged

[charts] Add environment check for warning messages in axis and radar hooks#22506
sai6855 merged 8 commits into
mui:masterfrom
sai6855:charts-warning-msgs

Conversation

@sai6855
Copy link
Copy Markdown
Member

@sai6855 sai6855 commented May 18, 2026

This PR adds environment checks to warnOnce calls where they were previously missing.

@sai6855 sai6855 added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: charts Changes related to the charts. labels May 18, 2026
@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 18, 2026

Deploy preview

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

Bundle size

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 ▼-80B(-0.02%) ▼-36B(-0.03%)
@mui/x-charts-pro ▼-80B(-0.02%) ▼-39B(-0.03%)
@mui/x-charts-premium ▼-80B(-0.01%) ▼-39B(-0.02%)
@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%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 941.06 ms +16.51 ms(+1.8%) | Renders: 30 (+0) | Paint: 1,317.93 ms +19.05 ms(+1.5%)

Test Duration Renders
ScatterChartPro with big data amount (single renderer) 16.07 ms ▼-5.92 ms(-26.9%) 2 (+0)
ScatterChartPro with big data amount and zoomed in (batch renderer) 8.62 ms ▼-4.75 ms(-35.5%) 2 (+0)
ScatterChartPro with big data amount and zoomed in (single renderer) 8.43 ms ▼-2.63 ms(-23.8%) 2 (+0)
ScatterChartPro with big data amount (batch renderer) 7.57 ms ▼-2.22 ms(-22.7%) 2 (+0)

10 tests within noise — details


Check out the code infra dashboard for more information about this PR.

sai6855 and others added 4 commits May 18, 2026 14:48
Improve warning message for missing series IDs in development mode.

Signed-off-by: sai chand <60743144+sai6855@users.noreply.github.com>
@sai6855 sai6855 marked this pull request as ready for review May 18, 2026 10:04
Copilot AI review requested due to automatic review settings May 18, 2026 10:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds process.env.NODE_ENV !== 'production' guards around warnOnce calls in chart axis and radar axis components, so warning code can be stripped from production builds.

Changes:

  • Guard warnOnce in ChartsXAxis with NODE_ENV check.
  • Guard warnOnce in ChartsYAxis with NODE_ENV check.
  • Guard warnOnce in useRadarAxis with NODE_ENV check.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/x-charts/src/ChartsXAxis/ChartsXAxis.tsx Wraps warning in dev-only env check
packages/x-charts/src/ChartsYAxis/ChartsYAxis.tsx Wraps warning in dev-only env check
packages/x-charts/src/RadarChart/RadarAxis/useRadarAxis.ts Wraps warning in dev-only env check

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

`MUI X Charts: Your radar axis tries to display values for the metric "${metric}" which does not exist.`,
`Either add this metric to your radar, or pick one from the existing metrics: ${existingMetrics.join(', ')}`,
]);
if (process.env.NODE_ENV !== 'production') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This condition should be on the previous if block to shorthand the entire block since we don't do/return anything from inside it

if (process.env.NODE_ENV !== 'production' && !existingMetrics.includes(metric)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed here 83e4640

@sai6855 sai6855 enabled auto-merge (squash) May 18, 2026 11:05
@sai6855 sai6855 merged commit c15aff8 into mui:master May 18, 2026
21 checks passed
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: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants