Преглед изворни кода

don't remove futures spawned by spawn_forever when the component is removed (#1708)

ealmloff пре 1 година
родитељ
комит
2e424436b3
1 измењених фајлова са 1 додато и 11 уклоњено
  1. 1 11
      packages/core/src/scope_context.rs

+ 1 - 11
packages/core/src/scope_context.rs

@@ -230,17 +230,7 @@ impl ScopeContext {
     /// This is good for tasks that need to be run after the component has been dropped.
     pub fn spawn_forever(&self, fut: impl Future<Output = ()> + 'static) -> TaskId {
         // The root scope will never be unmounted so we can just add the task at the top of the app
-        let id = self.tasks.spawn(ScopeId::ROOT, fut);
-
-        // wake up the scheduler if it is sleeping
-        self.tasks
-            .sender
-            .unbounded_send(SchedulerMsg::TaskNotified(id))
-            .expect("Scheduler should exist");
-
-        self.spawned_tasks.borrow_mut().insert(id);
-
-        id
+        self.tasks.spawn(ScopeId::ROOT, fut)
     }
 
     /// Informs the scheduler that this task is no longer needed and should be removed.