From 3cbf8ed6fafca4cacb03790a5ac366dedbe5118c Mon Sep 17 00:00:00 2001 From: Yin Jifeng Date: Mon, 13 Jun 2022 18:42:24 +0800 Subject: [PATCH] fix: remove task id from scope when success --- packages/core/src/scopes.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core/src/scopes.rs b/packages/core/src/scopes.rs index 27520dfd1..8db5efe56 100644 --- a/packages/core/src/scopes.rs +++ b/packages/core/src/scopes.rs @@ -1000,12 +1000,11 @@ impl TaskQueue { fn remove(&self, id: TaskId) { if let Ok(mut tasks) = self.tasks.try_borrow_mut() { let _ = tasks.remove(&id); + if let Some(task_map) = self.task_map.borrow_mut().get_mut(&id.scope) { + task_map.remove(&id); + } } - // the task map is still around, but it'll be removed when the scope is unmounted - if let Some(task_map) = self.task_map.borrow_mut().get_mut(&id.scope) { - task_map.remove(&id); - } } pub(crate) fn has_tasks(&self) -> bool {