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)
Wed, Oct 2, 7:02 AM
Unknown Object (File)
Tue, Oct 1, 6:48 PM
Unknown Object (File)
Wed, Sep 18, 10:23 PM
Unknown Object (File)
Wed, Sep 18, 10:23 PM
Unknown Object (File)
Wed, Sep 18, 10:23 PM
Unknown Object (File)
Wed, Sep 18, 10:23 PM
Unknown Object (File)
Wed, Sep 18, 10:20 PM
Unknown Object (File)
Aug 23 2024, 6:51 AM
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
Branch
ashoat/react18
Lint
No Lint Coverage
Unit
No Test Coverage

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.