feat: poll async once
This commit is contained in:
1 parent
94601ccd1f
commit
d2ce57ba6e
9 files changed
+150
-67
No files matched your search
@@ -131,7 +131,7 @@ impl SsrRender {
|
||||
// todo: escape the text
|
||||
write!(buf, "{}", value)?
|
||||
}
|
||||
DynamicNode::Fragment { children } => {
|
||||
DynamicNode::Fragment(children) => {
|
||||
for child in *children {
|
||||
self.render_template(buf, child)?;
|
||||
}
|
||||
@@ -140,6 +140,9 @@ impl SsrRender {
|
||||
DynamicNode::Component { .. } => {
|
||||
//
|
||||
}
|
||||
DynamicNode::Placeholder(el) => {
|
||||
//
|
||||
}
|
||||
},
|
||||
|
||||
Segment::PreRendered(text) => buf.push_str(&text),
|
||||
@@ -217,3 +220,29 @@ fn children_processes_properly() {
|
||||
dom.rebuild(&mut mutations);
|
||||
dbg!(mutations);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn async_children() {
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let d = 123;
|
||||
|
||||
render! {
|
||||
div {
|
||||
async_child {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn async_child(cx: Scope<'_>) -> Element {
|
||||
let d = 123;
|
||||
render! { p { "{d}" "hii" } }
|
||||
}
|
||||
|
||||
let mut dom = VirtualDom::new(app);
|
||||
|
||||
let mut mutations = vec![];
|
||||
dom.rebuild(&mut mutations);
|
||||
dbg!(mutations);
|
||||
}
|
||||
Reference in new issue
Block a user