Feat: reject invalid keys

This commit is contained in:
Jonathan Kelley committed 2024-03-07 16:03:00 -08:00
1 parent 6faa51a4a9
commit ae352f8958
6 files changed
+40 -23

No files matched your search

+10
View File
@@ -24,3 +24,13 @@ macro_rules! invalid_component_path {
return Err(Error::new($span, "Invalid component path syntax"));
};
}
macro_rules! invalid_key {
($_key:ident) => {
let val = $_key.to_static().unwrap();
return Err(syn::Error::new(
$_key.span(),
format!("Element keys must be a dynamic value. Considering using `key: {{{val}}}` instead.\nStatic keys will result in every element using the same key which will cause rendering issues or panics."),
));
};
}