Closed marc2332 closed 3 months ago
Problem spawn_forever tasks get attached to the scope
spawn_forever
The task will never get executed because it's attached to the Scope, and the Scope is being dropped.
#[allow(non_snake_case)] fn Counter() -> Element { use_drop(move || { println!("spawning"); spawn_forever(async move { println!("running"); }); }); None } fn app() -> Element { let mut count = use_signal(|| 0); rsx!( Button { onclick: move |_| count += 1, label { "Increase" } } Button { onclick: move |_| count -= 1, label { "Decrease" } } for i in 0..count() { Counter { key: "{i}" } } ) }
Expected behavior
Work
Environment:
Problem
spawn_forever
tasks get attached to the scopeThe task will never get executed because it's attached to the Scope, and the Scope is being dropped.
Expected behavior
Work
Environment: