DioxusLabs / DioxusLabs/dioxus

A general issue with signals "Already Borrowed"

Open
#4,124 6 comments 2 reactions 0 assignees View on GitHub
signals
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

Signals are extremely unstable. For me they keep leading to panics in production on the client side.

For example:
```rs
on_delete_point: move |i: usize| async move {
let point = points.write().remove(i);
point_fetched_all.write().remove(i);
markets.write().remove(i);
delete_point(point.id).await.expect("Should be able to delete point");

user_actions_context.write().push(format!("Deleted point {:?}", point.text_embedding));
},
```
If I call this twice, while point is already being deleted: Panic.

I don't thing signals are a good model and am not sure if there is even a way to address this without getting rid of them. But man. It's painful.

I've already said this in Dioxus's Discord. I really like Dioxus and think that the way you're doing most things are very smart. I am still not convinced that state management is one of them.

**Environment:**

- Dioxus version: 0.6.3

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.