-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't workingnativeRelated to dioxus-nativeRelated to dioxus-native
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:
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:
[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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingnativeRelated to dioxus-nativeRelated to dioxus-native