mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 11:04:40 -05:00
fix: use correct/full type names for matched routes to fix islands-router issues (closes #4378)
This commit is contained in:
@@ -364,6 +364,12 @@ where
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct MatchedRoute(pub String, pub AnyView);
|
pub(crate) struct MatchedRoute(pub String, pub AnyView);
|
||||||
|
|
||||||
|
impl MatchedRoute {
|
||||||
|
fn branch_name(&self) -> String {
|
||||||
|
format!("{:?}", self.1.as_type_id())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Render for MatchedRoute {
|
impl Render for MatchedRoute {
|
||||||
type State = <AnyView as Render>::State;
|
type State = <AnyView as Render>::State;
|
||||||
|
|
||||||
@@ -414,8 +420,9 @@ impl RenderHtml for MatchedRoute {
|
|||||||
mark_branches: bool,
|
mark_branches: bool,
|
||||||
extra_attrs: Vec<AnyAttribute>,
|
extra_attrs: Vec<AnyAttribute>,
|
||||||
) {
|
) {
|
||||||
if mark_branches && escape {
|
let branch_name = (mark_branches && escape).then(|| self.branch_name());
|
||||||
buf.open_branch(&self.0);
|
if let Some(bn) = &branch_name {
|
||||||
|
buf.open_branch(bn);
|
||||||
}
|
}
|
||||||
self.1.to_html_with_buf(
|
self.1.to_html_with_buf(
|
||||||
buf,
|
buf,
|
||||||
@@ -424,8 +431,8 @@ impl RenderHtml for MatchedRoute {
|
|||||||
mark_branches,
|
mark_branches,
|
||||||
extra_attrs,
|
extra_attrs,
|
||||||
);
|
);
|
||||||
if mark_branches && escape {
|
if let Some(bn) = &branch_name {
|
||||||
buf.close_branch(&self.0);
|
buf.close_branch(bn);
|
||||||
if *position == Position::NextChildAfterText {
|
if *position == Position::NextChildAfterText {
|
||||||
*position = Position::NextChild;
|
*position = Position::NextChild;
|
||||||
}
|
}
|
||||||
@@ -442,8 +449,9 @@ impl RenderHtml for MatchedRoute {
|
|||||||
) where
|
) where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
if mark_branches && escape {
|
let branch_name = (mark_branches && escape).then(|| self.branch_name());
|
||||||
buf.open_branch(&self.0);
|
if let Some(bn) = &branch_name {
|
||||||
|
buf.open_branch(bn);
|
||||||
}
|
}
|
||||||
self.1.to_html_async_with_buf::<OUT_OF_ORDER>(
|
self.1.to_html_async_with_buf::<OUT_OF_ORDER>(
|
||||||
buf,
|
buf,
|
||||||
@@ -452,8 +460,8 @@ impl RenderHtml for MatchedRoute {
|
|||||||
mark_branches,
|
mark_branches,
|
||||||
extra_attrs,
|
extra_attrs,
|
||||||
);
|
);
|
||||||
if mark_branches && escape {
|
if let Some(bn) = &branch_name {
|
||||||
buf.close_branch(&self.0);
|
buf.close_branch(bn);
|
||||||
if *position == Position::NextChildAfterText {
|
if *position == Position::NextChildAfterText {
|
||||||
*position = Position::NextChild;
|
*position = Position::NextChild;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ pub struct AnyView {
|
|||||||
) -> Pin<Box<dyn Future<Output = AnyViewState>>>,
|
) -> Pin<Box<dyn Future<Output = AnyViewState>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AnyView {
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub fn as_type_id(&self) -> TypeId {
|
||||||
|
self.type_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Debug for AnyView {
|
impl Debug for AnyView {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.debug_struct("AnyView")
|
f.debug_struct("AnyView")
|
||||||
|
|||||||
Reference in New Issue
Block a user