dioxus
dioxus copied to clipboard
Component with `key` attribute does not pass a `ReadOnlySIgnal<bool>` attribute properly
Problem
With latest main in web, this app will display falsefalse when I would expect truefalse. Specifically, the is_on: true is not getting passed or getting ignored when there is a key on the component.
#![allow(non_snake_case)]
use dioxus::prelude::*;
#[derive(Clone, Routable, Debug, PartialEq)]
enum Route {
#[route("/")]
Home {},
}
fn main() {
launch(App);
}
fn App() -> Element {
rsx! {
Router::<Route> {}
}
}
#[component]
fn Comp(
is_on: ReadOnlySignal<bool>,
) -> Element {
rsx! {
"{is_on()}"
}
}
#[component]
fn Home() -> Element {
rsx! {
Comp {
key: "A",
is_on: true,
}
Comp {
key: "B",
is_on: false,
}
}
}
If you remove the key from the first Comp it will display what I would expect: truefalse. But I need to have a key on these elements.
Environment:
- Dioxus version: main
- App platform: web
Questionnaire
- [x] I'm interested in fixing this myself but don't know where to start
- [ ] I would like to fix and I have a solution
- [ ] I don't have time to fix this right now, but maybe later
I think this is a bug in hot reloading. The code snippet you posted does work in release mode
cargo.toml for consideration:
[dependencies]
dioxus = { path = "../dioxus/packages/dioxus", features = ["web", "router"] }
dioxus-logger = "0.5.1"