-
Hi everybody ! DescriptionI'm using Gatsby 2.32.13 with Material UI 4.11.1 and styled component 5.1.1 to develop our website company. Sometimes, CSS and Links does not work and I do not have any data in my logs :/ Some screenshot to understand : Links work (you can see the url at the bottom left) : Titles in my footer are white, CSS works : Let's make a ctrl + maj + R to hard refresh the page : Titles in my footer are black, CSS is broken : If I click to a page in my footer, I'm redirected and CSS works again, but it's not stable. Steps to reproduceGo to https://live-for-good.netlify.app Expected resultLinks working and CSS still the same Actual resultLinks are broken and CSS too. Environment
It looks like to be a plugin problem, so, this is my package.json :
And my gatsby-config :
It does not work in local with Thank you for your help ! :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You could try updating your site to Gatsby v3 and the latest versions of all packages that you use. For more specific help on Material UI you should ask here: https://github.com/hupe1980/gatsby-plugin-material-ui |
Beta Was this translation helpful? Give feedback.
-
Hi everybody ! We found the problem ! :D So, we just add a NoSsr wrapper component from Material UI and it solved the problem ! Thank you for your help @LekoArts :) Have a good day ! |
Beta Was this translation helpful? Give feedback.
Hi everybody !
We found the problem ! :D
We have a custom Link component to make the difference between internal and external links + to add the language in the url.
But, we are using
window.location.pathname
for that.We thought to add a condition
if (window !== null)...
but it was not enough, we didn't have any problem during the build, but we had a problem with the SSR, because the client rendering was different to the server rendering.So, we just add a NoSsr wrapper component from Material UI and it solved the problem !
Thank you for your help @LekoArts :)
Have a good day !