-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Flatten function performance issue v4 #2424
Comments
I'm wanting to give a try and fix this. do you have a way to reproduce this outside your app? can you publish something that I can clone and try? |
You can trigger that code path by passing a non-styled component SFC into a style interpolation. |
let my try to create something that reproduces it in codesandbox. I usually like to reproduce the problem first before trying to attack it. |
@alansouzati Unfortunately I've not been able to reproduce this outside our app. I'll keep you updated if I can reproduce / make any progress. |
@mariel9999999 are you using the "component selector" pattern?
see the |
@alansouzati Yes. |
just as a test, if you remove it, does the problem go away too? I'm trying to debug what is going on but I'm pretty new to their source code. |
@alansouzati Nope. It is still laggy after removing all component selectors. |
I couldn't pin-point my problems down to |
@mariel9999999 can you try |
@probablyup Yup that fixes it. Here's what it looks like when performing the same action (left = @alansouzati Thanks for fixing this! |
Having recently tried to upgrade our styled-components from v3 to v4 in a relatively large react app - we've ran into a strange performance issue that seems to be tied to the flatten function. When commenting out this part of flatten, the issue seems to resolve:
styled-components/packages/styled-components/src/utils/flatten.js
Lines 59 to 72 in 9b81695
Here are screenshots of performance snapshots run with chrome dev tools when performing the same action in our app on v3 vs. v4:
v3
v4
Strangely, we have not been able to reproduce this in a clean slate react app.
Environment
System:
Binaries:
npmPackages:
Reproduction
Unable to reproduce with a basic react app created via
create-react-app
.Expected Behavior
Performance is as good if not better than v3.
Actual Behavior
Performance is sluggish, significantly slower than v3.
The text was updated successfully, but these errors were encountered: