diff --git a/packages/hooks/src/use_resource.rs b/packages/hooks/src/use_resource.rs index 7816a0db7..f10db5e38 100644 --- a/packages/hooks/src/use_resource.rs +++ b/packages/hooks/src/use_resource.rs @@ -119,6 +119,13 @@ pub struct Resource { callback: UseCallback, } +impl Clone for Resource { + fn clone(&self) -> Self { + *self + } +} +impl Copy for Resource {} + /// A signal that represents the state of the resource // we might add more states (panicked, etc) #[derive(Clone, Copy, PartialEq, Hash, Eq, Debug)] diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index 3d689dda0..f266aa2d7 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -244,12 +244,16 @@ impl<'a> ToTokens for TemplateRenderer<'a> { attr_paths: &[ #(#attr_paths),* ], }; - dioxus_core::VNode::new( - #key_tokens, - TEMPLATE, - Box::new([ #( #node_printer),* ]), - Box::new([ #(#dyn_attr_printer),* ]), - ) + { + // NOTE: Allocating a temporary is important to make reads within rsx drop before the value is returned + let __vnodes = dioxus_core::VNode::new( + #key_tokens, + TEMPLATE, + Box::new([ #( #node_printer),* ]), + Box::new([ #(#dyn_attr_printer),* ]), + ); + __vnodes + } }); } }