Faster & Safer account switching on macOS

This commit is contained in:
Thomas Ricouard 2023-01-18 13:51:24 +01:00
parent d737b429b4
commit 23cf2a3751
2 changed files with 5 additions and 2 deletions

View file

@ -99,7 +99,8 @@ struct IceCubesApp: App {
tab tab
.makeContentView(popToRootTab: $popToRootTab) .makeContentView(popToRootTab: $popToRootTab)
.opacity(tab == selectedTab ? 1 : 0) .opacity(tab == selectedTab ? 1 : 0)
.id(tab) .transition(.opacity)
.id("\(tab)\(appAccountsManager.currentAccount.id)")
.onAppear { .onAppear {
sideBarLoadedTabs.insert(tab) sideBarLoadedTabs.insert(tab)
} }
@ -108,6 +109,8 @@ struct IceCubesApp: App {
} }
} }
} }
}.onChange(of: $appAccountsManager.currentAccount.id) { _ in
sideBarLoadedTabs.removeAll()
} }
} }

View file

@ -54,7 +54,7 @@ struct TimelineTab: View {
timeline = isAuth ? .home : .federated timeline = isAuth ? .home : .federated
}) })
.onChange(of: currentAccount.account?.id, perform: { _ in .onChange(of: currentAccount.account?.id, perform: { _ in
timeline = client.isAuth ? .home : .federated timeline = client.isAuth && canFilterTimeline ? .home : .federated
}) })
.onChange(of: $popToRootTab.wrappedValue) { popToRootTab in .onChange(of: $popToRootTab.wrappedValue) { popToRootTab in
if popToRootTab == .timeline { if popToRootTab == .timeline {