fix crash where homeViewTwo view model wasnt being updated

This commit is contained in:
Trey t
2022-02-21 22:38:07 -06:00
parent 83060e8353
commit 769c6335d9
7 changed files with 50 additions and 18 deletions

View File

@@ -72,8 +72,8 @@ struct MonthDetailView: View {
deleteEnabled,
selectedEntry.mood != .missing {
Button(String(localized: "content_view_delete_entry"), action: {
updateEntries()
PersistenceController.shared.update(entryDate: selectedEntry.forDate!, withModd: .missing)
updateEntries()
showUpdateEntryAlert = false
})
}

View File

@@ -43,6 +43,9 @@ class HomeViewViewModel: ObservableObject {
self.getGroupedData(addMonthStartWeekdayPadding: self.addMonthStartWeekdayPadding)
}
PersistenceController.shared.listeners.append { [weak self] in
self?.updateData()
}
updateData()
}