-
Notifications
You must be signed in to change notification settings - Fork 7
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
Flash of components before styled components styles #8
Comments
Sorry for the late reply. Have you read the Pitfalls / Notes section of the readme? maybe the discussion between @jozefmery and me can help you understand more? #2 Apart from that I'd need more details to understand your scenario. |
Maybe related, so I have some work related with Ant Design and Remix, so that definitely needs SSR. But, I'm also using Tailwind for the utility classes as well. For some reasons, when I used only the Tailwind components, the stylings are consistent no matter how many times I refreshed the browser. However, with Ant Design components added, sometimes the browser "lost" the Tailwind styles for a glimpse (but the Ant Design stylings persist because it's added directly with the After I tried to PoC it in this repository (https://github.com/imballinst/remix-antd-random-fouc-repro/tree/main/remix), I somewhat found out that this part is the thing that causes the glimpse of missing Tailwind styles, because the links are included inside the Line 68 in e601727
After I removed it, then I couldn't reproduce it anymore, each refresh result in both Tailwind and Ant Design stylings showing up consistently. Not sure if that's related, but I'm curious regardless. What was the original purpose of the |
Hey @imballinst thanks for reaching out! These comments are pretty essential to how remix-island is working. It might not be relevant for your app. But one of the great things with remix is that different routes can have different stuff in their With remix-island, remix itself does no longer control the Here is the part in the code that picks up on those comments: https://github.com/Xiphe/remix-island/blob/main/src/index.ts#L122 As to you tailwind problem.
As your tailwind stylesheet is most likely constant across the whole page try moving it out of remix and into the |
I see. That's very interesting insight, and I definitely skipped/forgot that part of the README! Thanks for the answer @Xiphe, I'll see what I can do with that information 🙇♂️ |
@Xiphe Does it make sense to replace |
@dimik As mentioned earlier there shouldn't be a fouc when implemented correctly. If you experience it please share a repo that reproduces the issue. The styles have to be on the page before hydration anyways so wether we use useLayoutEffect or useEffect shouldn't make a difference. |
Hi first of all thank you for the workaround to use Styled Components with Remix. Can you help me understand what causes component to without styles flash, before the styled-components styles apply and how to avoid that.
The text was updated successfully, but these errors were encountered: