diff --git a/Tusker/Screens/Lists/EditListAccountsViewController.swift b/Tusker/Screens/Lists/EditListAccountsViewController.swift index 7a2d8ba536..11660b9931 100644 --- a/Tusker/Screens/Lists/EditListAccountsViewController.swift +++ b/Tusker/Screens/Lists/EditListAccountsViewController.swift @@ -12,12 +12,12 @@ import Combine class EditListAccountsViewController: EnhancedTableViewController { + private var list: List let mastodonController: MastodonController - private var list: List + var changedAccounts = false var dataSource: DataSource! - var nextRange: RequestRange? var searchResultsController: SearchResultsViewController! @@ -122,6 +122,7 @@ class EditListAccountsViewController: EnhancedTableViewController { } private func addAccount(id: String) async { + changedAccounts = true do { let req = List.add(list, accounts: [id]) _ = try await mastodonController.run(req) @@ -137,6 +138,7 @@ class EditListAccountsViewController: EnhancedTableViewController { } private func removeAccount(id: String) async { + changedAccounts = true do { let request = List.remove(list, accounts: [id]) _ = try await mastodonController.run(request) diff --git a/Tusker/Screens/Lists/ListTimelineViewController.swift b/Tusker/Screens/Lists/ListTimelineViewController.swift index 5c1c83cfac..eab7d02512 100644 --- a/Tusker/Screens/Lists/ListTimelineViewController.swift +++ b/Tusker/Screens/Lists/ListTimelineViewController.swift @@ -71,12 +71,15 @@ class ListTimelineViewController: TimelineViewController { } @objc func editListDoneButtonPressed() { + let presented = (presentedViewController as? UINavigationController)?.viewControllers.first as? EditListAccountsViewController + dismiss(animated: true) - // TODO: only reload if there were changes - Task { - applyInitialSnapshot() - await controller.loadInitial() + if presented?.changedAccounts == true { + Task { + applyInitialSnapshot() + await controller.loadInitial() + } } }