mirror of
https://github.com/leptos-rs/leptos
synced 2024-09-20 06:21:57 +00:00
This commit is contained in:
parent
39edb6eb45
commit
83d3d7579c
1 changed files with 4 additions and 1 deletions
|
@ -79,6 +79,7 @@ pub fn class_helper(
|
|||
name: Cow<'static, str>,
|
||||
value: Class,
|
||||
) {
|
||||
use crate::HydrationCtx;
|
||||
use leptos_reactive::create_render_effect;
|
||||
|
||||
let class_list = el.class_list();
|
||||
|
@ -86,7 +87,9 @@ pub fn class_helper(
|
|||
Class::Fn(cx, f) => {
|
||||
create_render_effect(cx, move |old| {
|
||||
let new = f();
|
||||
if old.as_ref() != Some(&new) && (old.is_some() || new) {
|
||||
if old.as_ref() != Some(&new)
|
||||
&& (old.is_some() || new || HydrationCtx::is_hydrating())
|
||||
{
|
||||
class_expression(&class_list, &name, new, true)
|
||||
}
|
||||
new
|
||||
|
|
Loading…
Reference in a new issue