DioxusLabs / DioxusLabs/dioxus
Native renderer not updating signal subscriber in checkbox "checked" property
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
**Problem**
When rendering with `dioxus_native`, signals that are read in element properties are not updated reactively, or are updated inconsistently. In my testing, the element re-rendered once, then ignored further updates. Global and local signals appear to behave identically.
**Steps To Reproduce**
My Rust code:
```rust
use dioxus_core_macro::{rsx, component};
use dioxus_native::prelude::*;
fn main() {
dioxus_native::launch(App);
}
#[component]
fn App() -> Element {
let mut BOOL_SIGNAL = use_signal(|| false);
rsx! {
div {
button {
onclick: move |_| {
*BOOL_SIGNAL.write() = !BOOL_SIGNAL();
},
"toggle"
}
input {
type: "checkbox",
// this value updates normally on web platform, but not with dioxus native
checked: *BOOL_SIGNAL.read()
}
}
}
}
```
My Cargo.toml:
```toml
[package]
name = "minimal_signal_repro"
version = "0.1.0"
authors = ["Lumen Keyes"]
edition = "2021"
[dependencies]
dioxus-web = { version = "0.7.3", features = [] , optional = true}
dioxus-core = { version = "0.7.3", features = []}
dioxus-signals = { version = "0.7.3", features = []}
dioxus-core-macro = { version = "0.7.3", features = []}
dioxus-html = { version = "0.7.3", features = []}
dioxus-hooks = { version = "0.7.3", features = []}
dioxus-hot-reload = { version = "0.5.6", features = []}
dioxus-native = { git = "https://github.com/DioxusLabs/blitz", rev = "7b728d7", features = ["prelude"] }
# tested with main and latest git version
# dioxus-native = { version = "0.7.3", features = ["prelude"] }
[features]
default = []
web = ["dioxus-web"]
desktop = []
mobile = []
```
**Expected behavior**
The value should update reactively, as it does on the web platform, or as it does on the native platform when read from inside a format string/text node.
**Environment:**
- Dioxus version: 0.7.3
- Rust version: 1.93.0
- OS info: Linux 6.12.68-1-MANJARO (X11, i3)
- App platform: desktop (native)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.