#4869·leptos

Option request : a `defer` option on `HydrationScripts` to keep the js & wasm off the LCP critical path

Author: jrouaixCreated Sep 2, 2026Updated Sep 2, 2026

Hello,

First, thank you for this amazing crate ! I'm rewriting a website from askama (SSR only) to leptos, and the next version Google PageSpeed numbers are assassinating the rewrite (virtually, I think it wont stop me to go full speed on this rewrite that is not far to an end).

The performances are super duper good, it's only that the whole wasm download on the critical path of the first paint and the module script imports and instantiates it as soon as it lands.

Proposal

Add an optional prop, off by default so nothing changes for existing apps:

xml
<HydrationScripts options defer=true />

Interactivity arrives a few hundred milliseconds later on a fast connection, which is the expected trade-off for a content-first, server-rendered page; forms with a plain method/action keep working before hydration. Apps that want the current behaviour keep defer = false (default).

What do you think ? Any chances this would be a expected request also for the rest of the community/users of leptos ?