-
-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
Description
Describe the feature
Related: #27
Most SSR js frameworks are streamable, we should support the same functionality with Unhead.
There is workarounds available but we should have an official solution that is documented.
Solving the Head Issue in Streaming HTML with Unhead
The Problem
Streaming HTML is sending content to the browser as it's created rather than waiting for the entire page to be ready. This approach has significant benefits:
- Faster time to first byte
- Lower server memory overhead
- Progressive browser rendering
- Better user experience with visible progress
However, there's a core challenge with the <head> section:
- The
<head>needs to be sent early in the response - Many
<head>elements (like<title>) depend on data that isn't immediately available - Waiting for this data defeats the purpose of streaming
Out-of-Order Streaming: The Solution
Instead of blocking the entire stream waiting for <head> data, we can use an approach called "out-of-order streaming":
- Stream a placeholder
<head>immediately - Continue streaming the rest of the page
- Update the
<head>content later when data becomes available
Additional information
- Would you be willing to help implement this feature?
pont1s, birkskyum and GeoffreyParrier