diff --git a/Mlem/Models/Trackers/SiteInformationTracker.swift b/Mlem/Models/Trackers/SiteInformationTracker.swift index 33b07bfd4..0fd58be25 100644 --- a/Mlem/Models/Trackers/SiteInformationTracker.swift +++ b/Mlem/Models/Trackers/SiteInformationTracker.swift @@ -23,12 +23,15 @@ class SiteInformationTracker: ObservableObject { version = account.siteVersion Task { do { + let response = try await apiClient.loadSiteInformation() enableDownvotes = response.siteView.localSite.enableDownvotes version = SiteVersion(response.version) if version != account.siteVersion { let avatarUrl = response.myUser?.localUserView.person.avatarUrl - accountsTracker.update(with: .init(from: account, avatarUrl: avatarUrl, siteVersion: version)) + DispatchQueue.main.async { + self.accountsTracker.update(with: .init(from: account, avatarUrl: avatarUrl, siteVersion: self.version)) + } } myUserInfo = response.myUser allLanguages = response.allLanguages diff --git a/Mlem/Views/Tabs/Settings/Components/AccountButtonView.swift b/Mlem/Views/Tabs/Settings/Components/AccountButtonView.swift index 332498791..4d381d817 100644 --- a/Mlem/Views/Tabs/Settings/Components/AccountButtonView.swift +++ b/Mlem/Views/Tabs/Settings/Components/AccountButtonView.swift @@ -13,6 +13,7 @@ struct AccountButtonView: View { @EnvironmentObject var appState: AppState @Dependency(\.accountsTracker) var accountsTracker: SavedAccountTracker @Environment(\.setAppFlow) private var setFlow + @Environment(\.dismiss) var dismiss @State var showingSignOutConfirmation: Bool = false @@ -126,6 +127,7 @@ struct AccountButtonView: View { private func setFlow(using account: SavedAccount?) { if let account { + dismiss() setFlow(.account(account)) return }