-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
styled-components fails in Facebook and TikTok browser #5144
Comments
Im experiencing similar issues outside of the context you describe. Basically any hydration error where react is forced to rebuild the As mentioned in #5159 I'd say this is not per se a remix bug but an architectural incompatibility as the issue can be reproduced with any react app failing to hydrate the whole document and might also happen to other libraries that inject things into the DOM. |
related issue in react: facebook/react#24430 |
I was able to work around the problem by:
Would still love to use latest react features within my app. |
+1 to this issue - Kent has responded to this issue here, stating that it is a React issue, which I think is fair enough, but I'm not sure if or when the React team would be doing anything about it. There's a potential workaround, but it's not great - you can render Remix not at the document level, but within a entry.client.tsx:
entry.server.tsx (an example using React 18 streams):
ServerRoot.tsx:
Where V1Meta is the Meta component from Remix, but takes the params from props rather than hooks (as the context is not created yet) The |
Thanks for sharing. I was also tinkering around with rendering the remix app into a sub-element of the page but gave up because it caused too many things I love about remix to stop working. As with the "who's problem is this": Yeah the issue lays between React and Styled Components. But Remix on the one hand made the architectural decision to work on the whole document which surfaces the problem and on the other hand advertises styled-components to work in remix apps (which it does but at the cost of react@18). |
I have created a proposal / discussion for this issue #5244 - give it an upvote! |
@kiliman figured out how to do this with the current tools and for me it solves the styled-components issues: #5244 (comment) |
@Xiphe awesome... glad it resolved the styled-components issue for you. |
This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed. |
This issue has been automatically closed because we didn't hear anything from the original author after the previous notice. |
What version of Remix are you using?
1.11.0
Steps to Reproduce
npx create-remix@latest project-name
basic
,typescript
,netlify
andn
so we can run yarnyarn add styled-components
yarn add -D @types/styled-components
update
entry.server.tsx
with:inside
root.tsx
file update the head tag to include styles:and deploy to netlify.
Here is an example project that replicates the issue:
https://github.com/marianzburlea/test-sc
and here is an example of the styled component receiving a red border.
https://steady-pixie-99fc00.netlify.app/
Expected Behavior
actual styles to be displayed
Actual Behavior
hydration fails and no styles are applied, when I click on a link from Facebook and Tiktok.
The BIG problem is not facebook messenger, it's how people that click paid ads see the website.
This is the same way users that click on an ad, end up on the website, with no styles.
The text was updated successfully, but these errors were encountered: