fix: use placeholder in comments for empty component names (#1850)

This commit is contained in:
Markus Kohlhase 2023-10-09 22:17:46 +02:00 committed by GitHub
parent 0676348bd4
commit c080c2cbca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -735,10 +735,16 @@ impl ToMarker for HydrationKey {
fn to_marker(
&self,
closing: bool,
#[cfg(debug_assertions)] component_name: &str,
#[cfg(debug_assertions)] mut component_name: &str,
) -> Oco<'static, str> {
#[cfg(debug_assertions)]
{
if component_name.is_empty() {
// NOTE:
// If the name is left empty, this will lead to invalid comments,
// so a placeholder is used here.
component_name = "<>";
}
if closing || component_name == "unit" {
format!("<!--hk={self}c|leptos-{component_name}-end-->").into()
} else {