DioxusLabs / DioxusLabs/dioxus

Iterator of rsx blocks causes signals/elements to affect unrelated things (strange behavior) even when key is set

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

Description

**Problem**

[First mentioned](https://discord.com/channels/899851952891002890/943190605067079712/1290331985213919355).

Each slider has a corresponding i32 signal and a few other things (reset button, oninput/onclick).

This works correctly:

```rs
Slider {
...
}
Slider {
...
}
Slider {
...
}
```

But this:

```rs
{
[ // Slice of tuples.
(..., ...),
(..., ...),
(..., ...),
].into_iter().map(|(name, ...)| rsx! {
Slider {
name: name,
...
}
})
}
```

causes some weird state/behavior issues. I even added the `key`:

```rs
#[component]
fn Slider(
SliderProps {
name,
}: SliderProps,
) -> Element {
rsx! {
div {
key: name,
```

I basically copied this:

https://github.com/DioxusLabs/dioxus/blob/357e05fc4b106848d75cee7c1dc990a6c70a2a9a/examples/rsx_usage.rs#L115-L122

**Steps To Reproduce**

Can't yet do that.

Steps to reproduce the behavior:

-
-
-

**Expected behavior**

Each slider must only affect stuff related to itself, not other sliders too.

**Environment:**
- Dioxus version: dioxus 0.6.0-alpha.2 (0d33c40)
- Rust version: rustc 1.82.0-nightly (c1a6199e9 2024-07-24)
- OS info: Pop!_OS
- App platform: `fullstack`

**Questionnaire**

- [ ] I'm interested in fixing this myself but don't know where to start
- [ ] I would like to fix and I have a solution
- [x] I don't have time to fix this right now, but maybe later

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.