Fix too restrictive Clone bounds in props with generics (#5451)

* Manually implement Clone for *WithOwner for less restrictive bounds.

* add tests

* fix clippy

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
Gabriël KonatandEvan Almloff authored and GitHub committed 2026-04-06 13:18:10 -05:00
1 parent d027e26046
commit a07b406699
2 files changed
+45 -2

No files matched your search

+9 -1
View File
@@ -1481,7 +1481,6 @@ Finally, call `.build()` to create the instance of `{name}`.
quote! {
#[doc(hidden)]
#[allow(dead_code, non_camel_case_types, missing_docs)]
#[derive(Clone)]
#vis struct #name #generics_with_bounds #where_clause {
inner: #original_name #ty_generics,
owner: dioxus_core::internal::generational_box::Owner,
@@ -1493,6 +1492,15 @@ Finally, call `.build()` to create the instance of `{name}`.
}
}
impl #original_impl_generics Clone for #name #ty_generics #where_clause {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
owner: self.owner.clone(),
}
}
}
impl #original_impl_generics #name #ty_generics #where_clause {
/// Create a component from the props.
pub fn into_vcomponent<M: 'static>(