make diffing a bit more resilient

This commit is contained in:
Evan Almloff committed 2024-01-11 17:21:38 -06:00
1 parent 6c29e2b825
commit 69da70fd32
2 files changed
+10 -10

No files matched your search

+8 -8
View File
@@ -131,10 +131,10 @@ impl VNode {
} }
Component(_comp) => { Component(_comp) => {
let scope = ScopeId(mount.mounted_dynamic_nodes[*id]); let scope = ScopeId(mount.mounted_dynamic_nodes[*id]);
match dom.get_scope(scope).unwrap().root_node() { dom.get_scope(scope)
RenderReturn::Ready(child) => child.find_first_element(dom), .unwrap()
_ => todo!("cannot handle nonstandard nodes"), .root_node()
} .find_first_element(dom)
} }
} }
} }
@@ -153,10 +153,10 @@ impl VNode {
Fragment(t) => t.last().unwrap().find_last_element(dom), Fragment(t) => t.last().unwrap().find_last_element(dom),
Component(_comp) => { Component(_comp) => {
let scope = ScopeId(mount.mounted_dynamic_nodes[*id]); let scope = ScopeId(mount.mounted_dynamic_nodes[*id]);
match dom.get_scope(scope).unwrap().root_node() { dom.get_scope(scope)
RenderReturn::Ready(node) => node.find_last_element(dom), .unwrap()
_ => todo!("cannot handle nonstandard nodes"), .root_node()
} .find_last_element(dom)
} }
} }
} }
+2 -2
View File
@@ -139,10 +139,10 @@ impl<F: Fn() -> Element> ComponentFunction<ZeroElementMarker> for F {
#[test] #[test]
fn test_empty_builder() { fn test_empty_builder() {
fn app() -> Element { fn app() -> Element {
todo!() unimplemented!()
} }
fn app2(_: ()) -> Element { fn app2(_: ()) -> Element {
todo!() unimplemented!()
} }
let builder = fc_to_builder(app); let builder = fc_to_builder(app);
builder.build(); builder.build();