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
.makeContentView(popToRootTab: $popToRootTab)
.opacity(tab == selectedTab ? 1 : 0)
.id(tab)
.transition(.opacity)
.id("\(tab)\(appAccountsManager.currentAccount.id)")
.onAppear {
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
})
.onChange(of: currentAccount.account?.id, perform: { _ in
timeline = client.isAuth ? .home : .federated
timeline = client.isAuth && canFilterTimeline ? .home : .federated
})
.onChange(of: $popToRootTab.wrappedValue) { popToRootTab in
if popToRootTab == .timeline {