-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[autocomplete] Avoid spread operator #40968
Conversation
cf0decc
to
1ed9af3
Compare
Netlify deploy previewhttps://deploy-preview-40968--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
// Need to clearly apply key because of https://github.com/vercel/next.js/issues/55642 | ||
return ( | ||
<li key={key} {...otherProps}> | ||
<li {...props2} key={props2.key}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've read the issue but I still can't wrap my head around what the cause is.
And yeah from a performance POV, using the spread operator is always bad, so for leaf elements it can be better to not use it. An easy escape hatch when one is simply transfering props could be to use directly React.createElement('li', props2, children)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
A quick follow-up on #39795 (comment). Adding comments to people in the future can figure out if this logic is still needed. And tried to speed up a bit the rendering.
To be noted that the problem isn't completely solved, the demos we have in the docs are 🙃
One iteration on #39833