Skip to content

Commit

Permalink
Merge branch 'ios-699-app-crashes-when-deleting-a-custom-api-access-m…
Browse files Browse the repository at this point in the history
…ethod'
  • Loading branch information
buggmagnet committed May 29, 2024
2 parents 322bff6 + c4d789a commit c58361e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class ListAccessMethodViewController: UIViewController, UITableViewDelegate {
}

private func updateDataSource(animated: Bool = true) {
guard let dataSource else { return }
fetchedItems = interactor.fetch()

var snapshot = NSDiffableDataSourceSnapshot<ListAccessMethodSectionIdentifier, ListAccessMethodItemIdentifier>()
Expand All @@ -168,11 +169,13 @@ class ListAccessMethodViewController: UIViewController, UITableViewDelegate {
}
snapshot.appendItems(itemIdentifiers, toSection: .primary)

for item in fetchedItems {
snapshot.reloadItems([ListAccessMethodItemIdentifier(id: item.id)])
if dataSource.snapshot().numberOfItems == fetchedItems.count {
for item in fetchedItems {
snapshot.reloadItems([ListAccessMethodItemIdentifier(id: item.id)])
}
}

dataSource?.apply(snapshot, animatingDifferences: animated)
dataSource.apply(snapshot, animatingDifferences: animated)
}

private func dequeueCell(
Expand Down

0 comments on commit c58361e

Please sign in to comment.