diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index dc1a295194..fb79b3f8ea 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -96,7 +96,15 @@ impl WorktreeStore { pub fn remove_worktree(&mut self, id_to_remove: WorktreeId, cx: &mut ModelContext) { self.worktrees.retain(|worktree| { if let Some(worktree) = worktree.upgrade() { - worktree.read(cx).id() != id_to_remove + if worktree.read(cx).id() == id_to_remove { + cx.emit(WorktreeStoreEvent::WorktreeRemoved( + worktree.entity_id(), + id_to_remove, + )); + false + } else { + true + } } else { false }