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:
parent
04de2c20d4
commit
31ed3fc0e1
@ -21,9 +21,7 @@ class AppViewModel {
|
|||||||
self.factory = factory
|
self.factory = factory
|
||||||
setupNotificationObservers()
|
setupNotificationObservers()
|
||||||
|
|
||||||
Task {
|
loadSetupStatus()
|
||||||
await loadSetupStatus()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupNotificationObservers() {
|
private func setupNotificationObservers() {
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user