-
If I want a page to show contents during a long I've observed having Since disabling ssr is still render-blocking, I don't really see a benefit to disabling ssr. Related to #7116 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
You can disable SSR app wide in a root I don't think there is a way to await |
Beta Was this translation helpful? Give feedback.
-
What exactly do you want to show before the load completes? And is this on navigation or initial SSR? One approach: For initial load via SSR, you could use a global loading state store which is set to For navigation, hook into |
Beta Was this translation helpful? Give feedback.
-
Thank you @s3812497 and @danawoodman for your suggestions. I've concluded that different situations may call for different solutions when it comes to presenting placeholder data while critical data is taking longer than usual to load; and it isn't necessarily the responsibility of SvelteKit's Custom intermediate state while a page loadsFor my needs, displaying a 'loading' message of some kind while transitioning to a new page can be achieved with a custom loading flag, <script>
import { beforeNavigate, afterNavigate } from '$app/navigation'
// ...
let loading = false
beforeNavigate((nav) => {
loading = true
})
afterNavigate(() => {
loading = false
})
</script>
<!-- ... -->
{#if loading}
Loading...
{:else}
<slot />
{/if} ✅ everything is server-side rendered Using
|
Beta Was this translation helpful? Give feedback.
Thank you @s3812497 and @danawoodman for your suggestions. I've concluded that different situations may call for different solutions when it comes to presenting placeholder data while critical data is taking longer than usual to load; and it isn't necessarily the responsibility of SvelteKit's
load
method to provide intermediate states.Custom intermediate state while a page loads
For my needs, displaying a 'loading' message of some kind while transitioning to a new page can be achieved with a custom loading flag,
beforeNavigate
, andafterNavigate
in a wrapping layout. Here is a rough demonstration of that effect: https://stackblitz.com/edit/sveltejs-kit-ssr-states?file=src%2Froutes%2Fmerg…