-
Notifications
You must be signed in to change notification settings - Fork 481
Partial FOUC due to missing critical css #2367
Comments
Are you getting an error/warnings on your server during requests? |
Thanks for your reply. I'm a bit new to reporting issues so bear with me. I was actually getting 2 css related errors on the server. I've fixed them now and the problem still exists. Do you need any more information? The problem is that basically the page looks aweful untill styles.{version}.css is loaded. |
I've updated the initial report including a test-server url running on angular 9.1.1. |
I am using bootstrap CSS, might that be of an issue maybe? |
No, that should not matter. |
Would it be possible to share a reproduction even privately? |
I'll try to strip it down to the core and share something with you tomorrow. |
Hi @bsumter, Thanks for sharing the reproduction. I did take a look at it and the live sites again and what I noticed is that when disabling JavaScript the application doesn't render correctly. It appears that the images are loaded using JavaScript via the swiper library, this seems to be the root cause of the content shift which is also causing space not to be reserved. |
Hi Alan, Correct. With the upgrade to v12 I've also implemented async loading of the swiper images, but that's not the issue here. This is the content shift I'm talking about: The problem is basically that the initial render is missing all of the base css. Easiest way to reproduce (basically slow down the requests):
|
It appears that certain selectors such as As a temporary workaround you can disable critical css inlining as shown below. server.ts server.engine('html', ngExpressEngine({
bootstrap: AppServerModule,
+ inlineCriticalCss: false
})); angular.json in the build - "optimization": true,
+ "optimization": {
+ "styles": {
+ "inlineCritical": false
+ }
+ }, |
This should be fixed in version 12.1.2. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
What modules are related to this issue?
Is this a regression?
Yes (I believe), the previous version in which this bug was not present was: 9.X
Description
A clear and concise description of the problem...After upgrading from Angular 9.X to 12.1.0, I'm noticing a significant Flash of Unstyled Content (FOUC). The inline critical css is missing a lot of styling.
Short video of what's happening:
https://user-images.githubusercontent.com/22917990/136787279-6115a3ec-b881-4bec-b19b-ccb56bfd896f.mp4
🔬 Minimal Reproduction
Easiest way to reproduce is by going to our live site and press F5 with Cache disabled (via Developer tools).
Live site:
https://www.sportspace.nl/
Test server running on angular 9.1.1:
https://sportspace-tst.azurewebsites.net/
🔥 Exception or Error
None.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: