fixed panic on DynChild for double taking an option

This commit is contained in:
Jose Quesada 2022-12-08 18:15:57 -06:00
parent e641108ed3
commit 21716ea59d
2 changed files with 11 additions and 10 deletions

View file

@ -1,3 +1,5 @@
#![allow(warnings)]
#[macro_use]
extern crate tracing;
@ -22,16 +24,16 @@ fn main() {
.finish()
.init();
// mount_to_body(view_fn);
mount_to_body(view_fn);
let disposer =
leptos_reactive::create_scope(leptos_reactive::create_runtime(), |cx| {
let view = view_fn(cx).into_view(cx);
// let disposer =
// leptos_reactive::create_scope(leptos_reactive::create_runtime(), |cx| {
// let view = view_fn(cx).into_view(cx);
let render = view.render_to_string();
// let render = view.render_to_string();
println!("{render}");
});
// println!("{render}");
// });
}
fn view_fn(cx: Scope) -> impl IntoView {
@ -112,10 +114,10 @@ fn view_fn(cx: Scope) -> impl IntoView {
.child(text("Click me (undelegated)"))
.into_view(cx),
pre(cx)
.child(EachKey::new(
.child(Each::new(
iterable,
|i| *i,
move |i| text(format!("{i}, ")),
move |cx, i| text(format!("{i}, ")),
))
.into_view(cx),
pre(cx)

View file

@ -167,7 +167,6 @@ where
} else {
if !HydrationCtx::is_hydrating() {
// Remove the child
let child = child_borrow.take().unwrap();
let start = child.get_opening_node();
let end = &closing;