Merge pull request #1199 from Demonthos/use-server-function

Use server function hook
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2023-07-20 12:49:47 -07:00
commit 3af0355196
19 files changed
+696 -198

No files matched your search

+11 -2
View File
@@ -1,4 +1,6 @@
//! Exentsions to the incremental renderer to support pre-caching static routes.
use core::pin::Pin;
use std::future::Future;
use std::str::FromStr;
use dioxus::prelude::*;
@@ -47,7 +49,9 @@ where
route,
&mut tokio::io::sink(),
|vdom| {
let _ = vdom.rebuild();
Box::pin(async move {
let _ = vdom.wait_for_suspense().await;
})
},
wrapper,
)
@@ -65,7 +69,12 @@ where
}
/// Render a route to a writer.
pub async fn render_route<R: WrapBody + Send + Sync, Rt, W, F: FnOnce(&mut VirtualDom)>(
pub async fn render_route<
R: WrapBody + Send + Sync,
Rt,
W,
F: FnOnce(&mut VirtualDom) -> Pin<Box<dyn Future<Output = ()> + '_>>,
>(
renderer: &mut IncrementalRenderer,
route: Rt,
writer: &mut W,