diff --git a/packages/core/src/diff/component.rs b/packages/core/src/diff/component.rs index 047951dfa..a95d6113c 100644 --- a/packages/core/src/diff/component.rs +++ b/packages/core/src/diff/component.rs @@ -65,10 +65,18 @@ impl VNode { dom: &mut VirtualDom, to: &mut impl WriteMutations, ) { + println!( + "diffing vcomponent: {new:#?} vs {old:#?}", + new = new, + old = old + ); + // Replace components that have different render fns if old.render_fn != new.render_fn { + println!("render fns are different, replacing"); return self.replace_vcomponent(mount, idx, new, parent, dom, to); } + println!("render fns are the same, continuing"); // copy out the box for both let old_scope = &mut dom.scopes[scope_id.0]; diff --git a/packages/core/tests/context_api.rs b/packages/core/tests/context_api.rs index 40aacb6b7..8a1d70402 100644 --- a/packages/core/tests/context_api.rs +++ b/packages/core/tests/context_api.rs @@ -14,7 +14,7 @@ fn state_shares() { } fn child_2() -> Element { - let value = consume_context::().unwrap(); + let value = consume_context::(); rsx!("Value is {value}") } diff --git a/packages/core/tests/diff_component.rs b/packages/core/tests/diff_component.rs index 33fe2773b..b6ea0cc46 100644 --- a/packages/core/tests/diff_component.rs +++ b/packages/core/tests/diff_component.rs @@ -12,7 +12,7 @@ fn component_swap() { render_phase += 1; - match *render_phase() { + match render_phase() { 0 => rsx! { nav_bar {} dash_board {} diff --git a/packages/core/tests/lifecycle.rs b/packages/core/tests/lifecycle.rs index 27fbd9b73..8ea5113b3 100644 --- a/packages/core/tests/lifecycle.rs +++ b/packages/core/tests/lifecycle.rs @@ -45,7 +45,7 @@ fn events_generate() { fn app() -> Element { let mut count = use_signal(|| 0); - match *count() { + match count() { 0 => rsx! { div { onclick: move |_| count += 1, div { "nested" } diff --git a/packages/core/tests/miri_full_app.rs b/packages/core/tests/miri_full_app.rs index 200213da5..a62d782b7 100644 --- a/packages/core/tests/miri_full_app.rs +++ b/packages/core/tests/miri_full_app.rs @@ -38,7 +38,7 @@ fn app() -> Element { } button { onclick: move |_| idx -= 1, "-" } ul { - {(0..*idx()).map(|i| rsx! { + {(0..idx()).map(|i| rsx! { ChildExample { i: i, onhover: onhover } })} } diff --git a/packages/core/tests/miri_simple.rs b/packages/core/tests/miri_simple.rs index 5520870be..8c6a77eae 100644 --- a/packages/core/tests/miri_simple.rs +++ b/packages/core/tests/miri_simple.rs @@ -42,7 +42,7 @@ fn contexts_drop() { } fn ChildComp() -> Element { - let el = consume_context::().unwrap(); + let el = consume_context::(); rsx! { div { "hello {el}" } } } @@ -77,7 +77,7 @@ fn root_props_drop() { struct RootProps(String); let mut dom = VirtualDom::new_with_props( - |cx| rsx!( div { "{cx.0}" } ), + |cx: RootProps| rsx!( div { "{cx.0}" } ), RootProps("asdasd".to_string()), ); diff --git a/packages/core/tests/miri_stress.rs b/packages/core/tests/miri_stress.rs index 574772251..298d1f5af 100644 --- a/packages/core/tests/miri_stress.rs +++ b/packages/core/tests/miri_stress.rs @@ -144,8 +144,8 @@ fn supports_async() { use tokio::time::sleep; fn app() -> Element { - let colors = use_signal(|| vec!["green", "blue", "red"]); - let padding = use_signal(|| 10); + let mut colors = use_signal(|| vec!["green", "blue", "red"]); + let mut padding = use_signal(|| 10); use_hook(|| { spawn(async move { @@ -171,7 +171,7 @@ fn supports_async() { }) }); - let colors = colors(); + let colors = colors.read(); let big = colors[0]; let mid = colors[1]; let small = colors[2]; diff --git a/packages/core/tests/suspense.rs b/packages/core/tests/suspense.rs index 01fd23840..2957bc0a8 100644 --- a/packages/core/tests/suspense.rs +++ b/packages/core/tests/suspense.rs @@ -31,7 +31,7 @@ fn app() -> Element { fn suspended_child() -> Element { let mut val = use_signal(|| 0); - if *val() < 3 { + if val() < 3 { spawn(async move { val += 1; }); diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index dd67a9dba..484f38151 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -201,7 +201,7 @@ impl<'a> ToTokens for TemplateRenderer<'a> { }; let key_tokens = match key { - Some(tok) => quote! { Some( #tok ) }, + Some(tok) => quote! { Some( #tok.to_string() ) }, None => quote! { None }, };