Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hydration warnings / mismatched styles due to SSR #31

Merged
merged 5 commits into from
Jan 19, 2022

Conversation

bryphe-coder
Copy link
Contributor

While starting on the create workspace flow - I noticed some weird CSS issues.

In particular, intermittently, the web UI would render like this:
image

...and when that happened, there'd be an accompanying error in the console:

image

The issue is that NextJS is trying to render the page on the server and use the styles - and sometimes the classnames mismatch between server-side and client-side rendering. We actually worked around this in cdr/m with a <SafeHydration /> component and a custom _document.tsx

This change ports over both the component and custom _document.tsx. I noticed, in addition, I missed the favicons when switching to NextJS, so I brought those over too.

@bryphe-coder bryphe-coder self-assigned this Jan 19, 2022
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #31 (a645b20) into main (6e6eee6) will decrease coverage by 0.32%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
- Coverage   69.26%   68.94%   -0.33%     
==========================================
  Files          40       41       +1     
  Lines        1630     1642      +12     
  Branches        7        9       +2     
==========================================
+ Hits         1129     1132       +3     
- Misses        396      406      +10     
+ Partials      105      104       -1     
Flag Coverage Δ
unittest-go-macos-latest 62.94% <ø> (-0.38%) ⬇️
unittest-go-ubuntu-latest 69.03% <ø> (+0.20%) ⬆️
unittest-go-windows-latest 63.39% <ø> (+0.29%) ⬆️
unittest-js 65.33% <0.00%> (-5.69%) ⬇️
Impacted Files Coverage Δ
site/pages/_app.tsx 0.00% <0.00%> (ø)
site/pages/_document.tsx 0.00% <0.00%> (ø)
peer/conn.go 75.22% <0.00%> (+0.91%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e6eee6...a645b20. Read the comment docs.

site/pages/_document.tsx Outdated Show resolved Hide resolved
site/pages/_app.tsx Outdated Show resolved Hide resolved
@bryphe-coder bryphe-coder merged commit 36b7b20 into main Jan 19, 2022
@bryphe-coder bryphe-coder deleted the bryphe/fix/css-hydration-errors branch January 19, 2022 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants