From e3dd55533fd5223ca48f10175e7f72f8e9247aea Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 4 Jan 2023 11:38:34 -0600 Subject: [PATCH] handle removing a future that does not exist --- packages/core/src/scheduler/task.rs | 4 ++-- packages/core/src/scheduler/wait.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/scheduler/task.rs b/packages/core/src/scheduler/task.rs index 39c770a06..997953f8e 100644 --- a/packages/core/src/scheduler/task.rs +++ b/packages/core/src/scheduler/task.rs @@ -59,9 +59,9 @@ impl Scheduler { /// Drop the future with the given TaskId /// - /// This does nto abort the task, so you'll want to wrap it in an aborthandle if that's important to you + /// This does not abort the task, so you'll want to wrap it in an aborthandle if that's important to you pub fn remove(&self, id: TaskId) { - self.tasks.borrow_mut().remove(id.0); + self.tasks.borrow_mut().try_remove(id.0); } } diff --git a/packages/core/src/scheduler/wait.rs b/packages/core/src/scheduler/wait.rs index 9268cfeb0..8ec1776c2 100644 --- a/packages/core/src/scheduler/wait.rs +++ b/packages/core/src/scheduler/wait.rs @@ -34,7 +34,7 @@ impl VirtualDom { self.scopes[task.scope.0].spawned_tasks.remove(&id); // Remove it from the scheduler - tasks.remove(id.0); + tasks.try_remove(id.0); } }