diff --git a/packages/core/src/scopes.rs b/packages/core/src/scopes.rs index 11d45d5c1..63a9144f2 100644 --- a/packages/core/src/scopes.rs +++ b/packages/core/src/scopes.rs @@ -348,49 +348,8 @@ impl<'src> ScopeState { /// } /// ``` pub fn render(&'src self, rsx: LazyNodes<'src, '_>) -> Element<'src> { - // <<<<<<< HEAD - // let element = rsx.call(self); - - // let mut listeners = self.attributes_to_drop_before_render.borrow_mut(); - // for attr in element.dynamic_attrs { - // attr.ty.for_each(|attr| { - // match attr.value { - // // We need to drop listeners before the next render because they may borrow data from the borrowed props which will be dropped - // AttributeValue::Listener(_) => { - // let unbounded = unsafe { std::mem::transmute(attr as *const Attribute) }; - // listeners.push(unbounded); - // } - // // We need to drop any values manually to make sure that their drop implementation is called before the next render - // AttributeValue::Any(_) => { - // let unbounded = unsafe { std::mem::transmute(attr as *const Attribute) }; - // self.previous_frame().add_attribute_to_drop(unbounded); - // } - - // _ => (), - // } - // }) - // } - - // let mut props = self.borrowed_props.borrow_mut(); - // let mut drop_props = self - // .previous_frame() - // .props_to_drop_before_reset - // .borrow_mut(); - // for node in element.dynamic_nodes { - // if let DynamicNode::Component(comp) = node { - // let unbounded = unsafe { std::mem::transmute(comp as *const VComponent) }; - // if !comp.static_props { - // props.push(unbounded); - // } - // drop_props.push(unbounded); - // } - // } - - // Some(element) - // ======= // Note: We can't do anything in this function related to safety because the user could always circumvent it by creating a VNode manually and return it without calling this function Some(rsx.call(self)) - // >>>>>>> 9fe172e9 (Fix leak in render macro) } /// Create a [`crate::VNode`] from the component parts diff --git a/packages/core/tests/fuzzing.rs b/packages/core/tests/fuzzing.rs index b16d9b3bb..76065ccc1 100644 --- a/packages/core/tests/fuzzing.rs +++ b/packages/core/tests/fuzzing.rs @@ -171,27 +171,16 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode { match rand::random::() % range { 0 => DynamicNode::Placeholder(Default::default()), 1 => cx.make_node((0..(rand::random::() % 5)).map(|_| { - // <<<<<<< HEAD - // VNode::new( - // None, - // Template { - // ======= cx.vnode( None.into(), Default::default(), Cell::new(Template { - // >>>>>>> 9fe172e9 (Fix leak in render macro) name: concat!(file!(), ":", line!(), ":", column!(), ":0"), roots: &[TemplateNode::Dynamic { id: 0 }], node_paths: &[&[0]], attr_paths: &[], - // <<<<<<< HEAD - // }, - // bumpalo::collections::Vec::new_in(cx.bump()), - // ======= }), bumpalo::collections::Vec::new_in(cx.bump()).into(), - // >>>>>>> 9fe172e9 (Fix leak in render macro) cx.bump().alloc([cx.component( create_random_element, DepthProps { depth, root: false }, @@ -285,19 +274,12 @@ fn create_random_element(cx: Scope) -> Element { ) .into_boxed_str(), )); - // <<<<<<< HEAD - // let node = VNode::new( - // None, - // template, - // bumpalo::collections::Vec::new_in(cx.bump()), - // ======= - // println!("{template:#?}"); + println!("{template:#?}"); let node = cx.vnode( None.into(), None, Cell::new(template), bumpalo::collections::Vec::new_in(cx.bump()).into(), - // >>>>>>> 9fe172e9 (Fix leak in render macro) { let dynamic_nodes: Vec<_> = dynamic_node_types .iter() diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index 5e685680d..70d03fc52 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -254,18 +254,12 @@ impl<'a> ToTokens for TemplateRenderer<'a> { node_paths: &[ #(#node_paths),* ], attr_paths: &[ #(#attr_paths),* ], }; -// <<<<<<< HEAD -// ::dioxus::core::VNode::new( -// #key_tokens, -// TEMPLATE, -// dioxus::core::exports::bumpalo::collections::Vec::with_capacity_in(#root_count, __cx.bump()), -// ======= + __cx.vnode( None.into(), #key_tokens, std::cell::Cell::new(TEMPLATE), dioxus::core::exports::bumpalo::collections::Vec::with_capacity_in(#root_count, __cx.bump()).into(), -// >>>>>>> 9fe172e9 (Fix leak in render macro) __cx.bump().alloc([ #( #node_printer ),* ]), __cx.bump().alloc([ #( #dyn_attr_printer ),* ]), )