From 9438421207ed225d7ce8cb5adc586926fa43cd27 Mon Sep 17 00:00:00 2001 From: Yusuf Suleman Date: Fri, 3 Apr 2026 02:01:30 -0500 Subject: [PATCH] fix: GoalsViewModel use repo.loadDay instead of missing goals() Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Features/Fitness/ViewModels/GoalsViewModel.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ios/Platform/Platform/Features/Fitness/ViewModels/GoalsViewModel.swift b/ios/Platform/Platform/Features/Fitness/ViewModels/GoalsViewModel.swift index 9721154..7243a31 100644 --- a/ios/Platform/Platform/Features/Fitness/ViewModels/GoalsViewModel.swift +++ b/ios/Platform/Platform/Features/Fitness/ViewModels/GoalsViewModel.swift @@ -2,7 +2,7 @@ import Foundation @MainActor @Observable final class GoalsViewModel { - var goal: DailyGoal = .defaultGoal + var goal: DailyGoal = DailyGoal() var isLoading = true var errorMessage: String? @@ -11,13 +11,11 @@ final class GoalsViewModel { func load() async { isLoading = true errorMessage = nil - - do { - goal = try await repo.goals(for: Date().apiDateString, forceRefresh: true) - } catch { - errorMessage = error.localizedDescription + await repo.loadDay(date: Date().apiDateString) + goal = repo.goals + if let err = repo.error { + errorMessage = err } - isLoading = false } }