fix: hydration for attributes with Option<_> (closes #2793) (#2794)

This commit is contained in:
Greg Johnston 2024-08-08 14:11:26 -04:00 committed by GitHub
parent 8670365594
commit d1248d3faf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -505,13 +505,7 @@ where
key: &str,
el: &R::Element,
) -> Self::State {
// if we're actually hydrating from SSRed HTML, we don't need to set the attribute
// if we're hydrating from a CSR-cloned <template>, we do need to set non-StaticAttr attributes
let state = if !FROM_SERVER {
self.map(|v| v.hydrate::<FROM_SERVER>(key, el))
} else {
None
};
let state = self.map(|v| v.hydrate::<FROM_SERVER>(key, el));
(el.clone(), state)
}