fix: handle directives properly in SSR mode (closes #2488) (#2477)

This commit is contained in:
Greg Johnston 2024-04-01 17:29:30 -04:00 committed by GitHub
parent 9f1c09e131
commit a9034a92b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -429,6 +429,21 @@ fn attribute_to_tokens_ssr<'a>(
{ _ = #value; }
});
}
} else if let Some(directive_name) = name.strip_prefix("use:") {
let handler = syn::Ident::new(directive_name, attr.key.span());
let value = attr.value();
let value = value.map(|value| {
quote! {
_ = #value;
}
});
exprs_for_compiler.push(quote! {
#[allow(unused_braces)]
{
_ = #handler;
#value
}
});
} else if name == "inner_html" {
return attr.value();
} else {