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
After upgrading to React Native Web 0.18, the markup CSS from the Server and the markup CSS from the Client have different spacing rules, and because of that, it triggers a hydration error when using React Native Web with Remix.
I was trying to debug why our website started to break randomly in production when a URL Scroll-To-Text text fragment was added in the URL, and came across this issue which isn't exactly what happened to us but related, so I'll leave the issue I reported to the Chrome Team for future reference here in case it helps anyone: GoogleChromeLabs/text-fragments-polyfill#153
The problem
After upgrading to React Native Web 0.18, the markup CSS from the Server and the markup CSS from the Client have different spacing rules, and because of that, it triggers a hydration error when using React Native Web with Remix.
Server Style Element Markup
Client Style Element Markup
Hydration Error
Could the usage of
cssText
cause this?react-native-web/packages/react-native-web/src/exports/StyleSheet/dom/createOrderedCSSStyleSheet.js
Line 45 in 379da30
How to reproduce
I can't use CodeSandbox, since it doesn't support pnpm, so here's a repo:
Simplified test case: https://github.com/HorusGoul/rnw-css-hydration-bug-error-repro
Steps to reproduce:
pnpm install
pnpm dev
You can also use https://rnw-css-hydration-bug-error-repro.vercel.app/ without installing anything, but the hydration error gets omitted by the react production build.
In that page, I logged both outputs, the SSR style markup, and the Client one.
Expected behavior
Server markup should match client markup. In this case, the styles are the same, but the formatting is different.
Environment (include versions). Did this work in previous versions?
This was working before the internal refactor of Stylesheet (0.17).
Thank you!
The text was updated successfully, but these errors were encountered: