Fix component names when they are re-exported (#2744)

* Fix component names when they are re-exported
* Fix read only signal props expansion
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-07-30 12:28:19 -07:00
1 parent 34bdcd15cf
commit 115cc0ad42
5 files changed
+9 -23

No files matched your search

+4 -10
View File
@@ -57,12 +57,9 @@ pub trait Properties: Clone + Sized + 'static {
fn memoize(&mut self, other: &Self) -> bool;
/// Create a component from the props.
fn into_vcomponent<M: 'static>(
self,
render_fn: impl ComponentFunction<Self, M>,
component_name: &'static str,
) -> VComponent {
VComponent::new(render_fn, self, component_name)
fn into_vcomponent<M: 'static>(self, render_fn: impl ComponentFunction<Self, M>) -> VComponent {
let type_name = std::any::type_name_of_val(&render_fn);
VComponent::new(render_fn, self, type_name)
}
}
@@ -121,10 +118,7 @@ where
#[warnings::warning]
pub(crate) fn component_called_as_function<C: ComponentFunction<P, M>, P, M>(_: C) {
// We trim WithOwner from the end of the type name for component with a builder that include a special owner which may not match the function name directly
let mut type_name = std::any::type_name::<C>();
if let Some((_, after_colons)) = type_name.rsplit_once("::") {
type_name = after_colons;
}
let type_name = std::any::type_name::<C>();
let component_name = Runtime::with(|rt| {
current_scope_id()
.ok()
+2 -2
View File
@@ -29,12 +29,12 @@ pub(crate) fn RootScopeWrapper(props: RootProps<VComponent>) -> Element {
Box::new([]),
)))
.build()
.into_vcomponent(SuspenseBoundary, "SuspenseBoundary")
.into_vcomponent(SuspenseBoundary)
})]),
Box::new([]),
)))
.build()
.into_vcomponent(ErrorBoundary, "ErrorBoundary"),
.into_vcomponent(ErrorBoundary),
)]),
Box::new([]),
))
+1 -1
View File
@@ -178,8 +178,8 @@ impl SuspenseBoundaryPropsWithOwner {
pub fn into_vcomponent<M: 'static>(
self,
render_fn: impl ComponentFunction<SuspenseBoundaryProps, M>,
component_name: &'static str,
) -> VComponent {
let component_name = std::any::type_name_of_val(&render_fn);
VComponent::new(
move |wrapper: Self| render_fn.rebuild(wrapper.inner),
self,