-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<!--#--> in web title when translation string is used #105
Comments
Does this still occur if you remove the |
Both, with |
Hmm okay. I'll get on this! |
Even after running |
I have two hypotheses for this bug though:
|
Thanks @arctic-hen7 for looking into this. I'll try to give you a MRE soon. |
I believe this is because of sycamore ssr codegen. I'll take a look in this as well EDIT: This is most likely due to the way dynamic values are handled when rendering with |
OK, what was missing is an additional string next to the translated one, such as: #[perseus::head]
pub fn head() -> View<SsrNode> {
view! {
title { (t!("about")) " > Test" }
}
} This reproduces the problem in a clean i18n example. |
Hmm, on the other hand - the following works without the issue: #[perseus::head]
pub fn head() -> View<SsrNode> {
let foo = t!("about");
view! {
title { (foo) " | Bar" }
}
} Maybe this depends on how |
Ah I see. @lukechu10 this should be fixable by using SSR while explicitly telling Sycamore that it doesn't need to prepare for hydration (the head will never be hydrated). Is that possible? |
Just for the record, this is the minimal issue-triggering case: #[perseus::head]
pub fn head() -> View<SsrNode> {
view! {
title { ("Foo".to_string()) " | Bar" }
}
} |
Is this related to hydration? The issue persists even without the hydration feature in |
The reason this works is because there is a simple heuristic in |
No, I read through that chain a little hastily and misunderstood how |
Of course. |
By the same token, I'm also thinking that the |
It doesn't look like Perseus can tell Sycamore that the Given that this seems to be solely a Sycamore issue, I'll close this. |
|
No, putting everything inside a |
Describe the bug
Recently, a regression is introduced when displaying a head title. It occurs when the translation marco
t!()
is used within the head title tag of a page and instead of displaying only a translated string, comment tags are inserted, thus, the final translated string is displayed in a browser as<!--#-->translated string<!--/-->
.I don't know is it due to
sycamore
orperseus
but since it occurs whent!
macro is used, I report it here. When an ordinary string variable is used, everything is fine.To Reproduce
One can use the i18n example, and add the head function with the title:
Expected behavior
A translated string is displayed without comment tags.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: