Closed bryandbor closed 5 years ago
At first sight, I would try upgrading jss to the lastest alpha version. It looks like a duplicate of one of our existing issues.
At first sight, I would try upgrading jss to the lastest alpha version. It looks like a duplicate of one of our existing issues.
I know it isn't clear from the repo, but I also had the exact same issue even after upgrading to ^10.0.0-alpha.14
.
@bryandbor Make sure you are using jss@v10.0.0-alpha.14 https://github.com/bryandbor/Material-Razzle-Boiler/blob/master/yarn.lock#L5814. Tested and verified, it's a duplicate of #14887
@bryandbor Make sure you are using jss@v10.0.0-alpha.14 https://github.com/bryandbor/Material-Razzle-Boiler/blob/master/yarn.lock#L5814. Tested and verified, it's a duplicate of #14887
Alright. I thought I had tried a clean install of jss@next
aka alpha.14
, but I can see now that the yarn lock was causing it not to install the latest version. Thanks for the help. 👍
I'm creating a new project built on Razzle and I'm attempting to get SSR working correctly. However, despite following the SSR guide and the next SSR example as closely as possible, my SSR styles do not seem to be created at all. To test this, I also added a
console.log
statement to check what is being returned from my call tosheetsRegistry.toString()
, and the value is an empty string. It seems to me as though theStylesProvider
component is not utilizing thesheetsRegistry
when attempting to render the<App/>
and it's Material UI components/styles.Here are the contents of my files for context:
package.json
:render.js
(use
d by express app for rendering nearly all routes)client.js
(Not that it is vital here as the issue is missing CSS from the server)Expected Behavior 🤔
Material UI styles/classes will be added server-side to avoid needing to be generated client-side (initially at least).
Current Behavior 😯
If I remove the client-side code which deletes the server-side
<style/>
tag for clarity, it is clear that it is empty; therefore, the styles are all being generated client-side. This obviously causes the "flicker" that we all want to avoid when using SSR.Steps to Reproduce 🕹
My repo is private; but I forked almost all the same setup into this repo.
Context 🔦
SSR styling is, obviously, very important as I would like to avoid the flicker of unstyled HTML elements on the screen before displaying a beautiful UI.
For the record, I took a look at #9097; however, since this issue is based on Material UI V4, I can't be sure that the issues are related, and there didn't seem to be any SSR issues for V4 to help out either.
Your Environment 🌎