Compare commits
1 Commits
fix/issue-
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1c824f288 |
@@ -116,6 +116,14 @@ struct PlantDetailView: View {
|
|||||||
.task {
|
.task {
|
||||||
await viewModel.loadCareInfo()
|
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 {
|
.refreshable {
|
||||||
await viewModel.refresh()
|
await viewModel.refresh()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,12 @@ final class PlantDetailViewModel {
|
|||||||
isLoading = false
|
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
|
/// Loads an existing care schedule from the repository
|
||||||
private func loadExistingSchedule() async {
|
private func loadExistingSchedule() async {
|
||||||
do {
|
do {
|
||||||
|
|||||||
Reference in New Issue
Block a user