Skip to content

[code-infra] Remove unnecessary ref from HighlightedCode component #46151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented May 15, 2025

Fixes this warning in development mode:

Screenshot (52)

When plainStyle is true, the root becomes React.Fragment, which doesn't support the ref prop.

Since no parent component uses a ref on HighlightedCode, I removed forwardRef. I also checked this in MUI X and Toolpad.

Also made sure other is spread only when using MarkdownElement.

@ZeeshanTamboli ZeeshanTamboli added core Infrastructure work going on behind the scenes scope: docs-infra Specific to the docs-infra product scope: code-infra Specific to the core-infra product labels May 15, 2025
@mui-bot
Copy link

mui-bot commented May 15, 2025

Netlify deploy preview

https://deploy-preview-46151--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against bc78a0d

@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review May 15, 2025 12:53
@ZeeshanTamboli ZeeshanTamboli requested review from a team May 15, 2025 12:55
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.

I did not foudn any usage of ref in the MUI-X repository

@ZeeshanTamboli ZeeshanTamboli merged commit fc57655 into mui:master May 16, 2025
20 checks passed
@ZeeshanTamboli ZeeshanTamboli deleted the fix-HighlightedCode-component branch May 16, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes scope: code-infra Specific to the core-infra product scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants