-
-
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
Styles finding their way into completely unrelated components #3457
Comments
I'm experiencing something similar, was quite unsure as to what was happening. |
For people who want a quick fix: you should use version 5.1.1, installing anything after makes the bug appear |
Pinging @probablyup for visibility |
Really need a reproduction to even begin to help |
We were seeing the same thing on styled-components v5.1.0. Components, seemingly at random, would get injected with styles that we didn't specify. It worked fine locally but doing a production build (using Refreshing the page would sometimes manifest the issue, sometimes not. Using: We had to downgrade to v4.4.1 to fix the issue. |
In our case, replacing the fragment wrapper
Could be that sometimes this component will return an empty fragment |
This is often due to multiple versions of s-c being bundled. If you use |
Thanks Evan. |
If you using |
Closing due to missing reproduction |
Note for those running into an issue like this: 5.3.1 fixed my issue of wrong styles applied when built but not in dev (while running 5.2.3) |
Environment
System:
Binaries:
Reproduction
I recently divided my project into a monorepo using lerna and yarn workspaces. I am running
styled-components: 5.2.3
along withreact: 17.0.1
andreact-dom: 17.0.1
. After switching to a monorepo a weird bug occurred where styles from another styled component were finding their way into another component that has no connection. This is a simple example of what is happening.Locally everything works as expected, but when I build for production and deploy my application for some reason the styles for
StyledComponentA
find their way intoStyledComponentB
. Below is the exact code that is facing the issue:Expected Behavior
Styles should only effect their respective components.
Actual Behavior
Styles getting injected into another component that has no remote connection.
Just to clarify further this happens only to one component (as far as I can tell) and only in production.
The text was updated successfully, but these errors were encountered: