Fix crash when refreshing polls

This commit is contained in:
Shadowfacts 2022-05-09 15:54:27 -04:00
parent 0b6c16b0a6
commit 3e5c441b24
1 changed files with 3 additions and 1 deletions

View File

@ -213,7 +213,9 @@ extension MenuActionProvider {
case .success(let status, _): case .success(let status, _):
// todo: this shouldn't really use the viewContext, but for some reason saving the // todo: this shouldn't really use the viewContext, but for some reason saving the
// backgroundContext with the new version of the status isn't updating the viewContext // backgroundContext with the new version of the status isn't updating the viewContext
mastodonController.persistentContainer.addOrUpdate(status: status, context: mastodonController.persistentContainer.viewContext) DispatchQueue.main.async {
mastodonController.persistentContainer.addOrUpdate(status: status, context: mastodonController.persistentContainer.viewContext)
}
case .failure(let error): case .failure(let error):
if let toastable = self?.toastableViewController { if let toastable = self?.toastableViewController {
let config = ToastConfiguration(from: error, with: "Error Refreshing Poll", in: toastable, retryAction: nil) let config = ToastConfiguration(from: error, with: "Error Refreshing Poll", in: toastable, retryAction: nil)