-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
mui 5 causes icon flashing on initial page load with next js #34652
Comments
Also described here but was never fixed - #32775 |
Is this related to font awesome icons only, or SVG icons too? Can you link a github repository with a reproduction? |
@mnajdova I do not have a public repo for this so I will have to create one that can reproduce this. I have however added the 3 important file - app.js, document.js and my Layout.js
document.js
Layout.js
|
@mnajdova The suggestion I found on stackoverflow is to load the mui icons upfront. How can I do this for mui icons? For mui, I import one icon at a time How can I do a global import of mui icons upfront and prevent reimport? |
Maybe try forking the official example and start from there. The issue is not happening there - https://stackblitz.com/github/mui/material-ui/tree/master/examples/nextjs?file=README.md |
@mnajdova Thanks. Followed the example for app, document js but same issue. Has this anything to do with how emotion css is loaded first at the top before even page title? |
I fixed the issue with a hack in my high level code but I don't think this is the efficient way. It probably defeats the purpose of SSR Basically I wrapped my layout and everything around useEffect. thoughts?? I used useEffect but thinking about using https://reactjs.org/docs/hooks-reference.html#uselayouteffect
|
I am closing the issue, there is no clear reproduction, it works on the example project. Feel free to re-open in case if you create a reproduction repository. |
Looks like To keep the effect of the const cache = createCache({
key: 'css',
prepend: true,
}); This is memtioned in the docs: https://mui.com/material-ui/guides/interoperability/#tailwind-css Edit: placing <StyledEngineProvider injectFirst>
<CacheProvider value={emotionCache}>
...
</CacheProvider>
</StyledEngineProvider> |
any updates for this issue? i have the same issue on this version 👇 ` when page loads icons are so huge and then after 1 sec it goes back to original size. |
+1, same here, when the page loads icons are so huge, and then after 1 sec it goes back to its original size. next.js: 14.2.22 I'm using the |
Duplicates
Latest version
Steps to reproduce 🕹
Steps:
This was discussed briefly here but still happens - #32830
Current behavior 😯
Huge icons flash with nextjs
Example - https://fontawesome.com/v6/docs/web/use-with/react/use-with#next-js
Expected behavior 🤔
normal icons size
Context 🔦
large icons shows on initial page load
Your environment 🌎
next js 12.1.5 or 12.3.1
react 17.0.2
mui latest version 5 installed this week
The text was updated successfully, but these errors were encountered: