You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using your editor (VSCode), save the page.tsx file which will trigger a hot-reload of the dev server
Notice the button has disappeared
Describe the Bug
When the Next dev server performs a hot reload, the CSS ordering is corrupted. The original CSS ordering issue in Next.js was recently fixed via this PR. However, it appears there is more to the issue, which I am raising. (CC @shuding who fixed the original issue 🙏🏻 )
You can see from my screenshots that on initial load of the page, the CSS ordering is correct:
However, after a hot-reload, the ordering is corrupted:
In my repro, the Button disappears because in the layout CSS there is button reset CSS and thus it must come first before any page CSS.
Expected Behavior
When the Next dev server performs a hot-reload, the CSS order should be maintained and thus not corrupted.
Which browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered:
Closes#48807.
The issue seems to be introduced with recent React Float change, which isn't a real problem but a behavior change. Resources are layered by the `precedence` key and the style insertion logic can be simplified as "insert the new stylesheet right after the existing stylesheet in the same layer". When multiple stylesheets are inserted in the same render pass, their new order will be flipped.
This is a nice feature so we can always maintain the order of resources that might conflict.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 Binaries: Node: 18.12.1 npm: 8.19.2 Yarn: 3.5.0 pnpm: 8.1.1 Relevant packages: next: 13.3.2-canary.5 eslint-config-next: 13.3.0 react: 18.2.0 react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue
https://github.com/meebix/repro-nextjs-css-order
To Reproduce
page.tsx
file which will trigger a hot-reload of the dev serverDescribe the Bug
When the Next dev server performs a hot reload, the CSS ordering is corrupted. The original CSS ordering issue in Next.js was recently fixed via this PR. However, it appears there is more to the issue, which I am raising. (CC @shuding who fixed the original issue 🙏🏻 )
You can see from my screenshots that on initial load of the page, the CSS ordering is correct:
However, after a hot-reload, the ordering is corrupted:
In my repro, the Button disappears because in the
layout
CSS there is button reset CSS and thus it must come first before anypage
CSS.Expected Behavior
When the Next dev server performs a hot-reload, the CSS order should be maintained and thus not corrupted.
Which browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: