From 31ed3fc0e1759fe14faea07fa0845215cb74f390 Mon Sep 17 00:00:00 2001 From: Ilyas Hallak Date: Sun, 19 Oct 2025 19:06:35 +0200 Subject: [PATCH] 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 --- readeck/UI/AppViewModel.swift | 4 +--- readeck/UI/readeckApp.swift | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/readeck/UI/AppViewModel.swift b/readeck/UI/AppViewModel.swift index f16aa1e..cf97bc9 100644 --- a/readeck/UI/AppViewModel.swift +++ b/readeck/UI/AppViewModel.swift @@ -21,9 +21,7 @@ class AppViewModel { self.factory = factory setupNotificationObservers() - Task { - await loadSetupStatus() - } + loadSetupStatus() } private func setupNotificationObservers() { diff --git a/readeck/UI/readeckApp.swift b/readeck/UI/readeckApp.swift index 07d0fdd..1f50ad0 100644 --- a/readeck/UI/readeckApp.swift +++ b/readeck/UI/readeckApp.swift @@ -10,7 +10,7 @@ import netfox @main struct readeckApp: App { - @StateObject private var appViewModel = AppViewModel() + @State private var appViewModel = AppViewModel() @StateObject private var appSettings = AppSettings() @Environment(\.scenePhase) private var scenePhase