DioxusLabs / DioxusLabs/dioxus

0.7.0 Inline CSS properties not being removed

Open
#4,389 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

I have some elements that have their style attributes derived from signals. https://github.com/DioxusLabs/dioxus/pull/3950 causes styles to not be removed after they've been applied.

**Steps To Reproduce**

```rust
use dioxus::prelude::*;

fn main() {
dioxus::launch(App);
}

#[component]
fn App() -> Element {
let mut toggled = use_signal(|| false);
rsx! {
button {
style: if toggled() {
"border-radius: 12px; background-color: red;"
} else {
"border-radius: 0px;"
},
onclick: move |_| {
toggled.toggle();
},
{"Toggle Style"}
}
}
}
```
Steps to reproduce the behavior:

- Click the button to set the toggled signal to on
- The button will turn red
- Click the button to set the toggled signal to off
- The button will stay red

**Expected behavior**

The button should no longer be red once it is toggled off.

**Environment:**

- Dioxus version: 0.7.0
- App platform: web

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.