Change so that the tree controller can't be rebuilt before all async deletes have completed. Issue #1002

This commit is contained in:
Maurice Parker 2020-02-26 17:28:52 -08:00
parent 66ce3db1fc
commit 7c060bb068
1 changed files with 3 additions and 8 deletions

View File

@ -44,26 +44,21 @@ final class DeleteCommand: UndoableCommand {
}
func perform() {
BatchUpdate.shared.perform {
itemSpecifiers.forEach { $0.delete() {} }
treeController.rebuild()
}
registerUndo()
perform {}
}
func perform(completion: @escaping () -> Void) {
let group = DispatchGroup()
group.enter()
itemSpecifiers.forEach {
group.enter()
$0.delete() {
group.leave()
}
}
treeController.rebuild()
group.notify(queue: DispatchQueue.main) {
self.treeController.rebuild()
self.registerUndo()
completion()
}