From dc22b456345ac4273a2a6f996c3efafe72eeffd8 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Tue, 11 Feb 2025 21:47:17 +0330 Subject: [PATCH] fix `IntoProperty` not implemented for `(Element, JsValue)` --- tachys/src/reactive_graph/bind.rs | 67 +------------------------------ 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/tachys/src/reactive_graph/bind.rs b/tachys/src/reactive_graph/bind.rs index e5b603d402..adcf371111 100644 --- a/tachys/src/reactive_graph/bind.rs +++ b/tachys/src/reactive_graph/bind.rs @@ -494,72 +494,9 @@ pub enum BoolOrT { T(T), } -impl IntoProperty for BoolOrT -where - T: IntoProperty - + Into - + Clone - + 'static, -{ - type State = (Element, JsValue); - type Cloneable = Self; - type CloneableOwned = Self; - - fn hydrate( - self, - el: &Element, - key: &str, - ) -> Self::State { - match self.clone() { - Self::T(s) => { - s.hydrate::(el, key); - } - Self::Bool(b) => { - ::hydrate::(b, el, key); - } - }; - - (el.clone(), self.into()) - } - - fn build(self, el: &Element, key: &str) -> Self::State { - match self.clone() { - Self::T(s) => { - s.build(el, key); - } - Self::Bool(b) => { - ::build(b, el, key); - } - } - - (el.clone(), self.into()) - } - - fn rebuild(self, state: &mut Self::State, key: &str) { - let (el, prev) = state; - - match self { - Self::T(s) => s.rebuild(&mut (el.clone(), prev.clone()), key), - Self::Bool(b) => ::rebuild( - b, - &mut (el.clone(), prev.clone()), - key, - ), - } - } - - fn into_cloneable(self) -> Self::Cloneable { - self - } - - fn into_cloneable_owned(self) -> Self::CloneableOwned { - self - } -} - impl IntoProperty for Option> where - T: IntoProperty> + T: IntoProperty + Into + Clone + 'static, @@ -607,7 +544,7 @@ where let (el, prev) = state; match f { BoolOrT::T(s) => { - s.rebuild(&mut Some((el.clone(), prev.clone())), key) + s.rebuild(&mut (el.clone(), prev.clone()), key) } BoolOrT::Bool(b) => ::rebuild( b,