fix(healthchat): refresh the account status whenever settings appears

The banner kept telling the user to complete a profile they had just
completed, and nothing was fetched until the screen was actually shown.
This commit is contained in:
Sedat Qaja
2026-10-12 11:40:42 +02:00
parent d9524130fa
commit 1edfb8057f
6 changed files with 71 additions and 9 deletions
@@ -12,7 +12,8 @@ import SwiftUI
// service is main-actor state — the hook's requirements are all @MainActor anyway.
@MainActor
final class HealthChatSettingsScreenHook: SettingsScreenHookProtocol {
/// One load per session — the settings screen asks for this section on every body pass.
// Owned here rather than by the section: the settings screen asks for the section on
// every body pass. Nothing is fetched until the screen appears and asks for a refresh.
private var statusLoader: HealthChatAccountStatusLoader?
// Constructed during hook registration, before the main actor is reachable.
@@ -32,5 +33,9 @@ final class HealthChatSettingsScreenHook: SettingsScreenHookProtocol {
return AnyView(HealthChatAccountStatusSection(loader: statusLoader,
completeProfileAction: completeProfileAction))
}
func refreshAccountStatus() {
statusLoader?.load()
}
}
#endif