TextField rerendering causes global styles to recalculate on each keystroke with SC #28051
Closed
2 tasks done
Labels
component: text field
This is the name of the generic UI component, not the React module!
package: styled-engine-sc
Specific to styled-components
performance
Milestone
When using TextField and
@material-ui/styled-engine-sc
as a controlled input (in a render prop?), this part https://github.com/mui-org/material-ui/blob/7bdf8a35299fa4a7e9ae97eff5f3b074170c38ef/packages/material-ui/src/InputBase/InputBase.js#L486 causes the styled component blob <style> tag to redraw on each keystroke. I would assume that the styled-components' implementation of global styles is less efficient than emotion's (their source code uses a useLayoutEffect that flickers on each prop update).Video: https://vimeo.com/manage/videos/594582087
While it's not really noticeable in a demo, it scales at least linearly with the number of styles in a project.
Current Behavior 😯
Expected Behavior 🤔
Steps to Reproduce 🕹
Steps:
Context 🔦
Your Environment 🌎
`npx @material-ui/envinfo`
The text was updated successfully, but these errors were encountered: