Layout breaks on refresh
See original GitHub issueCurrent behavior: Page refresh causes layout to break.
This does not happen in development mode. Only on a production build, deployed.
- We don’t use
nth child
, only:nth-of-type
. This can be used right? I don’t see anything in the docs that say otherwise - We use breakpoints
- This page is rendered with SSR (by NextJS)
Is there any advice on how I can reproduce this? Or narrow down?
Also: it does not always happen. Only after some time it has been deployed. Like a few hours. Caching problems?
I’m having a bit of a hard time finding things to look towards on how to reproduce this or narrow down to a specific part. I understand that it is my job when filing a bug in this repo to give a reproduction. But I’m sort of out of things to look towards to solve this.
To reproduce: Do a page refresh on a specific page.
Expected behavior: Layout does not break on second page refresh.
Environment information:
react
version:17.0.2
@emotion/react
version:11.8.2
nextjs
version:11.1.4
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Layout breaks upon refresh using react
Im building a website using React JS and each time I refresh the page the layout breaks. What could be causing this?This is...
Read more >Responsive layout breaks when resized - need refresh
The problem is that jQuery Cycle isn't responsive. It sets the width of your images and can only change them on refresh. So,...
Read more >Breaks on page refresh · Issue #434 · desandro/masonry
The layout works perfectly fine if I go to the page directly, or via a href link. If I refresh the page (with...
Read more >Solved - Page Breaks (CSS) On Refresh! Help!
After refreshing once the css layout will be destroyed and a gigantic list of errors appears. Strangest thing of all: layout remains broken...
Read more >Basic Features: Fast Refresh
If you make a syntax error during development, you can fix it and save the file again. The error will disappear automatically, so...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s pretty consistently broken for me. It doesn’t matter “which request” I’m testing at any given moment. Maybe your “first request” doesn’t visit this page directly? And subsequent requests are just direct reloads on that page?
Nice investigation Andarist 😀
And this is one of the several reasons why I don’t do SSR unless it’s truly necessary 😂. I’ve solved this problem in the past by storing the user’s time zone so that the server can use that time zone when generating the HTML. The user time zone could be stored in the
Users
table in the database or encoded into the auth token. But if your app allows anonymous visitors, that makes this a lot harder and I don’t know how to handle that.