fix: Use @State instead of @StateObject for @Observable AppViewModel

- Replace @StateObject with @State for @Observable conformance
- Remove unnecessary Task wrapper in init
- Call loadSetupStatus() synchronously since it's already @MainActor
This commit is contained in:
Ilyas Hallak 2025-10-19 19:06:35 +02:00
parent 04de2c20d4
commit 31ed3fc0e1
2 changed files with 2 additions and 4 deletions

View File

@ -21,9 +21,7 @@ class AppViewModel {
self.factory = factory self.factory = factory
setupNotificationObservers() setupNotificationObservers()
Task { loadSetupStatus()
await loadSetupStatus()
}
} }
private func setupNotificationObservers() { private func setupNotificationObservers() {

View File

@ -10,7 +10,7 @@ import netfox
@main @main
struct readeckApp: App { struct readeckApp: App {
@StateObject private var appViewModel = AppViewModel() @State private var appViewModel = AppViewModel()
@StateObject private var appSettings = AppSettings() @StateObject private var appSettings = AppSettings()
@Environment(\.scenePhase) private var scenePhase @Environment(\.scenePhase) private var scenePhase