diff --git a/tachys/src/html/style.rs b/tachys/src/html/style.rs
index f4d5cdcf47..f5ebf9e351 100644
--- a/tachys/src/html/style.rs
+++ b/tachys/src/html/style.rs
@@ -445,10 +445,11 @@ impl IntoStyle for (Arc, Arc) {
if name != state.1 {
<(Arc, Arc) as IntoStyle>::reset(state);
}
- let (style, _prev_name, prev_value) = state;
+ let (style, prev_name, prev_value) = state;
if value != *prev_value {
Rndr::set_css_property(style, &name, &value);
}
+ *prev_name = name;
*prev_value = value;
}
@@ -512,10 +513,11 @@ impl<'a> IntoStyle for (&'a str, &'a str) {
if name != state.1 {
<(&'a str, &'a str) as IntoStyle>::reset(state);
}
- let (style, _prev_name, prev_value) = state;
+ let (style, prev_name, prev_value) = state;
if value != *prev_value {
Rndr::set_css_property(style, name, value);
}
+ *prev_name = name;
*prev_value = value;
}
@@ -575,10 +577,11 @@ impl<'a> IntoStyle for (&'a str, String) {
if name != state.1 {
<(&'a str, String) as IntoStyle>::reset(state);
}
- let (style, _prev_name, prev_value) = state;
+ let (style, prev_name, prev_value) = state;
if value != *prev_value {
Rndr::set_css_property(style, name, &value);
}
+ *prev_name = name;
*prev_value = value;
}
diff --git a/tachys/src/reactive_graph/style.rs b/tachys/src/reactive_graph/style.rs
index 5c4145de93..f8ba885fcd 100644
--- a/tachys/src/reactive_graph/style.rs
+++ b/tachys/src/reactive_graph/style.rs
@@ -105,7 +105,8 @@ where
fn rebuild(self, state: &mut Self::State) {
let (name, mut f) = self;
- let prev_value = state.effect.take_value();
+ // Name might've updated:
+ state.name = name;
state.effect = RenderEffect::new_with_value(
move |prev| {
let value = f.invoke().into();
@@ -120,7 +121,7 @@ where
unreachable!()
}
},
- prev_value,
+ state.effect.take_value(),
);
}