Page MenuHomePhabricator

Fix client-side hydration of SSR in React 18
ClosedPublic

Authored by ashoat on Dec 20 2022, 7:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 5:33 AM
Unknown Object (File)
Fri, Nov 22, 5:33 AM
Unknown Object (File)
Fri, Nov 22, 5:33 AM
Unknown Object (File)
Fri, Nov 22, 5:33 AM
Unknown Object (File)
Fri, Nov 22, 5:29 AM
Unknown Object (File)
Nov 10 2024, 7:56 PM
Unknown Object (File)
Nov 4 2024, 4:11 PM
Unknown Object (File)
Nov 4 2024, 4:11 PM
Subscribers

Details

Summary

See context in ENG-2504.

One serious issue remains here: the PersistGate makes initial client-side render not match SSR, which results in double-rendering the page on web. Not sure why this wasn't an issue before. It unfortunately affects prod just like dev, so this diff on its own won't fix things.

Test Plan

Render web and landing in both prod and dev

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

landing/package.json
36 ↗(On Diff #19926)

Bumped due to react-refresh-webpack-plugin: https://github.com/pmmmwh/react-refresh-webpack-plugin/

web/package.json
39 ↗(On Diff #19926)

Bumped due to react-refresh-webpack-plugin: https://github.com/pmmmwh/react-refresh-webpack-plugin/

web/root.js
41–46 ↗(On Diff #19926)

Contents of hot.js got moved into here. No need for that component anymore

atul accepted this revision.EditedDec 20 2022, 9:03 PM

Looks good, should we also remove the --hot flag from web/package.json and landing/package.json:

b49424.png (78×1 px, 18 KB)

? (Not sure if it's still required for fast refresh)

This revision is now accepted and ready to land.Dec 20 2022, 9:03 PM

Getting the following when I navigate to http://localhost/commlanding/keyservers:

d084b7.png (1×3 px, 263 KB)

Getting the following when I navigate to http://localhost/commlanding/investors:

e07151.png (1×3 px, 268 KB)

Same for /siwe as well which is what I need

also looks like there are additional changes to yarn.lock not captured in this diff when I run yarn cleaninstall

280523.png (1×3 px, 1 MB)

(Worth noting that I can close the RedBox and continue to where I need to be, so I'm effectively unblocked... it's just not a great experience)

Curiously, I get the error in the browser console, but I don't get a RedBox. Guessing it's an issue that's always existed... it appears that SSR for any landing endpoint returns the home page. Will resolve that in a later diff.

yarn.lock updates, remove --hot

This revision was landed with ongoing or failed builds.Dec 21 2022, 5:25 AM
This revision was automatically updated to reflect the committed changes.