mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 20:53:06 +00:00
Merge pull request #1055 from Demonthos/fix-hot-reload-svg
Fix hot reloading with namespaces
This commit is contained in:
commit
9390820f36
1 changed files with 15 additions and 0 deletions
|
@ -284,6 +284,17 @@ where
|
||||||
Ok(&*Box::leak(deserialized))
|
Ok(&*Box::leak(deserialized))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "serialize")]
|
||||||
|
fn deserialize_option_leaky<'a, 'de, D>(deserializer: D) -> Result<Option<&'static str>, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
let deserialized = Option::<String>::deserialize(deserializer)?;
|
||||||
|
Ok(deserialized.map(|deserialized| &*Box::leak(deserialized.into_boxed_str())))
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> Template<'a> {
|
impl<'a> Template<'a> {
|
||||||
/// Is this template worth caching at all, since it's completely runtime?
|
/// Is this template worth caching at all, since it's completely runtime?
|
||||||
///
|
///
|
||||||
|
@ -319,6 +330,10 @@ pub enum TemplateNode<'a> {
|
||||||
///
|
///
|
||||||
/// In HTML, this would be a valid URI that defines a namespace for all elements below it
|
/// In HTML, this would be a valid URI that defines a namespace for all elements below it
|
||||||
/// SVG is an example of this namespace
|
/// SVG is an example of this namespace
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "serialize",
|
||||||
|
serde(deserialize_with = "deserialize_option_leaky")
|
||||||
|
)]
|
||||||
namespace: Option<&'a str>,
|
namespace: Option<&'a str>,
|
||||||
|
|
||||||
/// A list of possibly dynamic attribues for this element
|
/// A list of possibly dynamic attribues for this element
|
||||||
|
|
Loading…
Reference in a new issue