remix-pwa / monorepo

Remix PWA v4
https://remix-pwa.run
MIT License
105 stars 23 forks source link

fix: stop useNetworkConnectivity from causing hydration errors. #255

Closed martin-wahlberg closed 2 weeks ago

martin-wahlberg commented 3 weeks ago

Description:

We encountered hydration errors like:

Error: Hydration failed because the initial UI does not match what was rendered on the server.

Solution:

The issue was resolved by rewriting the hook to use useSyncExternalStorage, ensuring consistency between server and client rendering.

Request for Review:

The change has been tested and eliminates the hydration errors. Looking forward to your feedback and hoping for a quick merge.

martin-wahlberg commented 2 weeks ago

@ShafSpecs are you able to have a look at this?

ShafSpecs commented 2 weeks ago

Sorry, just doing so. For some reason, I don't get emails about actions in this organization 🥲. I need to fix that, my bad

ShafSpecs commented 2 weeks ago

After the merge, you can check out your fix by installing the dev version, either via: npm i @remix-pwa/sw@dev or npx remix-pwa upgrade -D -p sw.

Sorry, I'm not with my PC this week and can't check it out fully. Once I'm able to, I would push to latest. And thx for the PR ❤️!

ShafSpecs commented 2 weeks ago

I mean client, just remembered the hook isn't in sw but the client package