fix: layout, 409 handling, edit habits/tasks/savings

This commit is contained in:
Cosmo
2026-03-25 18:03:36 +00:00
parent 0d5eef1b87
commit c9bd63d5e7
6 changed files with 563 additions and 0 deletions

View File

@@ -209,6 +209,15 @@ struct DashboardView: View {
recentlyLoggedHabitLogDate = today
await loadData(refresh: true)
scheduleUndoClear()
} catch APIError.serverError(let code, _) where code == 409 {
await MainActor.run {
if let idx = todayHabits.firstIndex(where: { $0.id == habit.id }) {
todayHabits[idx].completedToday = true
}
recentlyLoggedHabitId = habit.id
recentlyLoggedHabitLogDate = today
}
scheduleUndoClear()
} catch {
errorMessage = error.localizedDescription; showError = true
}