Compare commits
1 Commits
fix/issue-
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1c824f288 |
@@ -116,6 +116,14 @@ struct PlantDetailView: View {
|
||||
.task {
|
||||
await viewModel.loadCareInfo()
|
||||
}
|
||||
.onAppear {
|
||||
// Reload schedule from Core Data every time the view appears.
|
||||
// .task only runs on first appearance; this ensures task completion
|
||||
// states are always current when navigating back to this view.
|
||||
Task {
|
||||
await viewModel.refreshSchedule()
|
||||
}
|
||||
}
|
||||
.refreshable {
|
||||
await viewModel.refresh()
|
||||
}
|
||||
|
||||
@@ -144,6 +144,12 @@ final class PlantDetailViewModel {
|
||||
isLoading = false
|
||||
}
|
||||
|
||||
/// Reloads the care schedule from the repository.
|
||||
/// Call on view reappearance to pick up persisted task completions.
|
||||
func refreshSchedule() async {
|
||||
await loadExistingSchedule()
|
||||
}
|
||||
|
||||
/// Loads an existing care schedule from the repository
|
||||
private func loadExistingSchedule() async {
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user