-
Notifications
You must be signed in to change notification settings - Fork 29
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
Server side rendering wrong css styles #30
Comments
I have the same issue. To solve it I use Bootstrap's breakpoint classes instead. Not optimal considering there will be a lot of unnecessary rendering. Would appreciate if this issue can be solved. |
This is because while rendering in server, React cannot identify the breakpoint as breakpoints exist only in browsers. That's why we default to desktop breakpoint in server. One solution is to extend the api in a way that users can identify useragent from request header and pass it in to the lib as default. It will take some time to get it done as the approach is not standard and we will have to unify the approach for all server frameworks (Next, Gatsby, vanilla). |
Yes, this is exactly what I figured out while trying to surpass this problem. Is there any approach to handle this without re-render (and without integrating with server side)? |
Same issue here... :( Too bad this library could be very useful |
Same Issue here. Anyone with a workaround to it yet? |
Same issue. |
I reckon the problem lies here on the function It's probably a good idea to have an option to set that default value instead of having
With https://www.npmjs.com/package/device ( which powers https://github.com/rguerreiro/express-device ) it should be very easy to implement that.
I believe with the option to set default width and the |
I have created a PR #40 which adds this option to the library, this way at least we can set default value to be the From that point on I believe workaround can be implemented by users on case-to-case basis? I'm using Next.js myself, so i had to implement a quick fix, i was able to do it by installing https://www.npmjs.com/package/next-useragent and then calling the function cc: @YJoris @dongepulango @cyril94440 |
There is no magical fix for this but |
I've got Header that renders different elements depending on viewport. When mobile page is loaded, some css styles from desktop viewport are stay on mobile viewport elements, which is strange:
on mobile viewports results in:
Where
<divN>
some component.The text was updated successfully, but these errors were encountered: