Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[autocomplete] Avoid spread operator #40968

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Feb 6, 2024

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

@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Feb 6, 2024
@mui-bot
Copy link

mui-bot commented Feb 6, 2024

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 馃毇 dangerJS against 1ed9af3

Comment on lines +557 to +559
// 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}>
Copy link
Contributor

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).

Copy link
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

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

馃檶

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 馃悰 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants