From 667d30a7100d9e5170b451dbe7333230adacb8e9 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 26 Jun 2021 18:52:19 -0400 Subject: [PATCH] Fix crash when editing accounts in a list Closes #127 --- .../Lists/EditListAccountsViewController.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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) + } } } }