From d1b9703ee7373ae7be8ce0a9c00851931f04846d Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Tue, 9 Jan 2024 10:24:02 -0600 Subject: [PATCH] fix release mode --- packages/core/src/diff/node.rs | 12 ++---------- packages/core/src/properties.rs | 1 + packages/core/src/virtual_dom.rs | 2 +- packages/rsx/src/lib.rs | 2 -- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/core/src/diff/node.rs b/packages/core/src/diff/node.rs index 2c2ce98bb..e8963b4e3 100644 --- a/packages/core/src/diff/node.rs +++ b/packages/core/src/diff/node.rs @@ -518,16 +518,8 @@ impl VNode { } Element { .. } => { #[cfg(not(debug_assertions))] - let id = self.write_element_root( - mount, - node, - idx, - &mut attrs, - &mut nodes, - &[], - dom, - to, - ); + let id = + self.write_element_root(mount, idx, &mut attrs, &mut nodes, &[], dom, to); #[cfg(debug_assertions)] let id = self.write_element_root( mount, diff --git a/packages/core/src/properties.rs b/packages/core/src/properties.rs index 7eb3ea85e..c7800e900 100644 --- a/packages/core/src/properties.rs +++ b/packages/core/src/properties.rs @@ -57,6 +57,7 @@ impl Properties for () { true } } + // We allow components to use the () generic parameter if they have no props. This impl enables the "build" method // that the macros use to anonymously complete prop construction. pub struct EmptyBuilder; diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index 54e0f14f1..e7ea69245 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -271,7 +271,7 @@ impl VirtualDom { }; let root = dom.new_scope( - BoxedAnyProps::new(VProps::new(root, |_, _| unreachable!(), root_props, "root")), + BoxedAnyProps::new(VProps::new(root, |_, _| true, root_props, "root")), "app", ); diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index 4d2beaa2e..884794937 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -240,7 +240,6 @@ impl<'a> ToTokens for TemplateRenderer<'a> { // Render and release the mutable borrow on context let roots = quote! { #( #root_printer ),* }; - let root_count = self.roots.len(); let node_printer = &context.dynamic_nodes; let dyn_attr_printer = &context.dynamic_attributes; let node_paths = context.node_paths.iter().map(|it| quote!(&[#(#it),*])); @@ -256,7 +255,6 @@ impl<'a> ToTokens for TemplateRenderer<'a> { ::dioxus::core::VNode::new( #key_tokens, TEMPLATE, - Box::new([Default::default();#root_count]), Box::new([ #( #node_printer ),* ]), Box::new([ #( #dyn_attr_printer ),* ]), )