Discourse is a single-page Javascript application.
This means that navigation within the app is blazingly fast. The compromise with modern web applications is that they must be loaded and parsed on the initial page view. While we’ve been doing a lot of work over the years to optimize how we serve site assets, this can sometimes be a little bit slow based on device/network conditions.
Over the last few weeks, we’ve been actively working and testing potential improvements for the initial wait that users on slow connections/devices encounter. We’re happy to announce that starting from this commit, Discourse sites will now display a splash screen while site assets load.
What does it look like?
We’ve had this enabled on Meta for a while, so you might have already seen it. If not, here’s what it looks like.
How does it work?
If a user loads your Discourse site, and Discourse isn’t parsed within the next two seconds, we show the splash. So, It’s based on connection time + 2 seconds.
We don’t display the splash for users on fast devices/connections.
How do I get it?
This is a feature in core, and the setting is default enabled now, so all you need to do is update to the latest. If, by some chance, you experimented with the setting we added and don’t see it, make sure that you have the splash_screen
site setting enabled
What are the benefits?
On top of showing something to users on slow devices/connections. This feature also cuts down FCP/LCP delays on Discourse sites. We’ve built some internal tools to track FCP/LCP on Meta, and here’s what the results look like
Anything else I should know about?
The “loading” text that shows in the splash is based on the preloader_text
translation string. Our community has been fantastic, and that text has already been translated into many languages. If you prefer it to be something different, you can customize that string under /admin/customize/site_texts?q=preloader_text
on your site.
The splash screen does not delay your site in any way and only shows while the site assets load. Once the site is ready, the splash screen is immediately removed. There is no delay between the site being ready and removing the splash.