unqueue tasks when a scope is dropped

This commit is contained in:
Evan Almloff committed 2024-01-17 08:36:39 -06:00
1 parent 701093ede5
commit d28221bdc2
4 files changed
+21 -18

No files matched your search

+2 -7
View File
@@ -68,18 +68,13 @@ impl VirtualDom {
//
// Note: This will not remove any ids from the arena
pub(crate) fn drop_scope(&mut self, id: ScopeId) {
let (height, spawned_tasks) = {
let height = {
let scope = self.scopes.remove(id.0);
let context = scope.context();
let spawned_tasks = context.spawned_tasks.borrow();
let spawned_tasks: Vec<_> = spawned_tasks.iter().copied().collect();
(context.height, spawned_tasks)
context.height
};
self.dirty_scopes.remove(&DirtyScope { height, id });
for task in spawned_tasks {
self.runtime.remove_task(task);
}
}
}