-
-
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
StylesheetManager does not render all styles in iframes #2973
Comments
@probablyup looks like we’re not iFrame safe anymore, since even if a new target is passed the names record is shared and hence a rule group can only be inserted once
|
It looks like we already have a test for this... styled-components/packages/styled-components/src/models/test/StyleSheetManager.test.js Lines 136 to 197 in 4440112
|
I believe we have run into this issue as well when trying to upgrade to version 5. It seems that whichever frame or window happens to render a component first is given the styles for that component. |
Yes, I think we need to make sure that the name cache isn’t copied anymore but we forgot to send a patch for this in v5.0.1. I’ll open a quick PR for this 👍 |
Pattern is: everything witch is already used in "main" head is not used again in StyleSheetManager.target |
Hi. Any news? The same problem for us |
Hey guys, My team is currently using styled-components 4.4.1 and we are experiencing a similar issue as well |
Having the same issue here with child windows instead of iframes 😅 |
Environment
npx envinfo --system --binaries --npmPackages styled-components,babel-plugin-styled-components --markdown --clipboard
System:
Binaries:
Reproduction
styled-components v4.3.2
: https://primer.style/doctocat/components/do-dontstyled-components v5.0.0
: https://doctocat-ajl99nptm.now.sh/doctocat/components/do-dontChanges made between both deployments: primer/doctocat#108
Source code where
StylesheetManager
is used: https://github.com/dcastil/doctocat/blob/styled-components-v5/theme/src/components/frame.js#L17Steps to reproduce
styled-components-v5
yarn && yarn start
in repo roothttp://localhost:8000/components/do-dont
in browserExpected Behavior
CSS is rendered into head of each iframe.
Actual Behavior
Some CSS is rendered and some not. I couldn't find a pattern in which CSS is rendered and which isn't unfortunately. Also if I delete the first iframe in https://github.com/dcastil/doctocat/blob/styled-components-v5/docs/content/components/do-dont.mdx, other CSS is being rendered in the second one. So the
StylesheetManager
instances seem to interfere with each other.The text was updated successfully, but these errors were encountered: