diff --git a/packages/core/src/fragment.rs b/packages/core/src/fragment.rs index dbc8e8131..bfab2f98f 100644 --- a/packages/core/src/fragment.rs +++ b/packages/core/src/fragment.rs @@ -39,15 +39,15 @@ pub fn Fragment<'a>(cx: Scope<'a, FragmentProps<'a>>) -> Element { }) } -pub struct FragmentProps<'a>(Element<'a>); -pub struct FragmentBuilder<'a, const BUILT: bool>(Element<'a>); -impl<'a> FragmentBuilder<'a, false> { - pub fn children(self, children: Element<'a>) -> FragmentBuilder<'a, true> { +pub struct FragmentProps(Element); +pub struct FragmentBuilder(Element); +impl FragmentBuilder { + pub fn children(self, children: Element) -> FragmentBuilder { FragmentBuilder(children) } } -impl<'a, const A: bool> FragmentBuilder<'a, A> { - pub fn build(self) -> FragmentProps<'a> { +impl FragmentBuilder { + pub fn build(self) -> FragmentProps { FragmentProps(self.0) } } @@ -94,11 +94,10 @@ impl<'a, const A: bool> FragmentBuilder<'a, A> { /// ``` impl<'a> Properties for FragmentProps<'a> { type Builder = FragmentBuilder<'a, false>; - const IS_STATIC: bool = false; fn builder() -> Self::Builder { FragmentBuilder(None) } - unsafe fn memoize(&self, _other: &Self) -> bool { + fn memoize(&self, _other: &Self) -> bool { false } } diff --git a/packages/core/src/nodes.rs b/packages/core/src/nodes.rs index d3ad1875f..3d3afaeb3 100644 --- a/packages/core/src/nodes.rs +++ b/packages/core/src/nodes.rs @@ -41,11 +41,11 @@ impl<'a> Default for RenderReturn<'a> { /// The dynamic parts of the template are stored separately from the static parts. This allows faster diffing by skipping /// static parts of the template. #[derive(Debug, Clone)] -pub struct VNode<'a> { +pub struct VNode { /// The key given to the root of this template. /// /// In fragments, this is the key of the first child. In other cases, it is the key of the root. - pub key: Option<&'a str>, + pub key: Option, /// When rendered, this template will be linked to its parent manually pub(crate) parent: Cell>, @@ -58,25 +58,25 @@ pub struct VNode<'a> { /// The IDs for the roots of this template - to be used when moving the template around and removing it from /// the actual Dom - pub root_ids: RefCell>, + pub root_ids: RefCell>, /// The dynamic parts of the template - pub dynamic_nodes: &'a [DynamicNode<'a>], + pub dynamic_nodes: Vec, /// The dynamic parts of the template - pub dynamic_attrs: &'a [Attribute<'a>], + pub dynamic_attrs: Vec, } -impl<'a> VNode<'a> { +impl VNode { /// Create a template with no nodes that will be skipped over during diffing - pub fn empty(cx: &'a ScopeState) -> Element<'a> { + pub fn empty() -> Element { Some(VNode { key: None, parent: Default::default(), stable_id: Default::default(), - root_ids: RefCell::new(bumpalo::collections::Vec::new_in(cx.bump())), - dynamic_nodes: &[], - dynamic_attrs: &[], + root_ids: Default::default(), + dynamic_nodes: Vec::new(), + dynamic_attrs: Vec::new(), template: Cell::new(Template { name: "dioxus-empty", roots: &[], diff --git a/packages/core/src/properties.rs b/packages/core/src/properties.rs index 3f0d9ef97..9a36158fc 100644 --- a/packages/core/src/properties.rs +++ b/packages/core/src/properties.rs @@ -32,14 +32,11 @@ use crate::innerlude::*; /// data: &'a str /// } /// ``` -pub trait Properties: Sized { +pub trait Properties: Sized + 'static { /// The type of the builder for this component. /// Used to create "in-progress" versions of the props. type Builder; - /// An indication if these props are can be memoized automatically. - const IS_STATIC: bool; - /// Create a builder for this component. fn builder() -> Self::Builder; @@ -48,16 +45,15 @@ pub trait Properties: Sized { /// # Safety /// The user must know if their props are static, but if they make a mistake, UB happens /// Therefore it's unsafe to memoize. - unsafe fn memoize(&self, other: &Self) -> bool; + fn memoize(&self, other: &Self) -> bool; } impl Properties for () { type Builder = EmptyBuilder; - const IS_STATIC: bool = true; fn builder() -> Self::Builder { EmptyBuilder {} } - unsafe fn memoize(&self, _other: &Self) -> bool { + fn memoize(&self, _other: &Self) -> bool { true } } diff --git a/packages/core/src/scopes.rs b/packages/core/src/scopes.rs index 1a26d3847..552a9d5b9 100644 --- a/packages/core/src/scopes.rs +++ b/packages/core/src/scopes.rs @@ -87,9 +87,6 @@ pub struct ScopeState { pub(crate) render_cnt: Cell, - pub(crate) node_arena_1: BumpFrame, - pub(crate) node_arena_2: BumpFrame, - pub(crate) hooks: RefCell>>>, pub(crate) hook_idx: Cell,