DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.35k stars 740 forks source link

Reset subscriptions when components or hooks are rerun #2158

Closed ealmloff closed 2 weeks ago

ealmloff commented 3 months ago

Feature Request

Now that we have automatic subscriptions with signals, we can subscribe to different signals every time we re-run a component or hook depending on what signals are read during that specific run. This should prevent reruns in a few cases

For example, in the following code we only need to subscribe to signal if x is true:

if x {
    signal.read();
}

Implement Suggestion

Reset the subscription list every time we rerun a component or hook