diff --git a/Tusker/Screens/Lists/EditListAccountsViewController.swift b/Tusker/Screens/Lists/EditListAccountsViewController.swift index 16555210..d5a03be4 100644 --- a/Tusker/Screens/Lists/EditListAccountsViewController.swift +++ b/Tusker/Screens/Lists/EditListAccountsViewController.swift @@ -80,15 +80,15 @@ class EditListAccountsViewController: EnhancedTableViewController { self.nextRange = pagination?.older - self.mastodonController.persistentContainer.addAll(accounts: accounts) - - var snapshot = self.dataSource.snapshot() - snapshot.deleteSections([.accounts]) - snapshot.appendSections([.accounts]) - snapshot.appendItems(accounts.map { .account(id: $0.id) }) - - DispatchQueue.main.async { - self.dataSource.apply(snapshot) + self.mastodonController.persistentContainer.addAll(accounts: accounts) { + var snapshot = self.dataSource.snapshot() + snapshot.deleteSections([.accounts]) + snapshot.appendSections([.accounts]) + snapshot.appendItems(accounts.map { .account(id: $0.id) }) + + DispatchQueue.main.async { + self.dataSource.apply(snapshot) + } } } }