don't track label changes in home container view (since cor data can handle it)

This commit is contained in:
Satindar Dhillon
2022-04-23 21:18:58 -07:00
parent 915bec37d2
commit c0b1956d0a
2 changed files with 1 additions and 25 deletions

View File

@ -44,9 +44,7 @@ import Views
viewModel.loadItems(dataService: dataService, isRefresh: true)
}
.sheet(item: $viewModel.itemUnderLabelEdit) { item in
ApplyLabelsView(mode: .item(item)) { labels in
viewModel.updateLabels(itemID: item.unwrappedID, labels: labels)
}
ApplyLabelsView(mode: .item(item)) { _ in }
}
}
.navigationTitle("Home")

View File

@ -12,9 +12,6 @@ import Views
/// Track progress updates to be committed when user navigates back to grid view
var uncommittedReadingProgressUpdates = [String: Double]()
/// Track label updates to be committed when user navigates back to grid view
var uncommittedLabelUpdates = [String: [LinkedItemLabel]]()
@Published var items = [LinkedItem]()
@Published var isLoading = false
@Published var showPushNotificationPrimer = false
@ -191,11 +188,7 @@ import Views
for (key, value) in uncommittedReadingProgressUpdates {
updateProgress(itemID: key, progress: value)
}
for (key, value) in uncommittedLabelUpdates {
updateLabels(itemID: key, labels: value)
}
uncommittedReadingProgressUpdates = [:]
uncommittedLabelUpdates = [:]
}
private func updateProgress(itemID: String, progress: Double) {
@ -205,21 +198,6 @@ import Views
}
}
func updateLabels(itemID _: String, labels _: [LinkedItemLabel]) {
// TODO: -labels fix
// // If item is being being displayed then delay the state update of labels until
// // user is no longer reading the item.
// if selectedLinkItem != nil {
// uncommittedLabelUpdates[itemID] = labels
// return
// }
//
// guard let item = items.first(where: { $0.id == itemID }) else { return }
// if let index = items.firstIndex(of: item) {
// items[index].labels = labels
// }
}
private var searchQuery: String? {
if searchTerm.isEmpty, selectedLabels.isEmpty {
return nil