Closed
Description
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.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Expected Behavior 🤔
Steps to Reproduce 🕹
Steps:
- https://codesandbox.io/s/styled-components-forked-crstj?file=/src/demo.jsx
- Inspect the input and follow a style into the inspect mode
- Start typing in the input
- Notice the style tag flickering.
- Notice, at the bottom of the tag, the styles for the autofill flickering
Context 🔦
Your Environment 🌎
`npx @material-ui/envinfo`
Don't forget to mention which browser you used.
Output from `npx @material-ui/envinfo` goes here.