mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
Streamline streaming SSR
This commit is contained in:
parent
c4cc3e944b
commit
fcae17eab7
1 changed files with 4 additions and 6 deletions
|
@ -212,7 +212,8 @@ where IV: IntoView
|
|||
|
||||
let tail = "</body></html>";
|
||||
|
||||
let html_stream = futures::stream::once(async move { head.clone() })
|
||||
HttpResponse::Ok().content_type("text/html").streaming(
|
||||
futures::stream::once(async move { head.clone() })
|
||||
.chain(render_to_stream_with_prefix(
|
||||
app,
|
||||
|cx| {
|
||||
|
@ -222,11 +223,8 @@ where IV: IntoView
|
|||
format!("{head}</head><body>").into()
|
||||
}
|
||||
))
|
||||
.chain(futures::stream::once(async { tail.to_string() }));
|
||||
|
||||
HttpResponse::Ok().content_type("text/html").streaming(
|
||||
html_stream
|
||||
.map(|html| Ok(web::Bytes::from(html)) as Result<web::Bytes>),
|
||||
.chain(futures::stream::once(async { tail.to_string() }))
|
||||
.map(|html| Ok(web::Bytes::from(html)) as Result<web::Bytes>),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue