Fix issue where navigation fails pop to root when switching timelines

Sometimes the navigation stack fails to pop, fix this

Changelog-Fixed: Fix issue where navigation fails pop to root when switching timelines
This commit is contained in:
William Casarin
2023-02-07 14:06:27 -08:00
parent 29c4170833
commit 0563ec8bf8
2 changed files with 12 additions and 0 deletions

View File

@@ -138,6 +138,12 @@ struct ContentView: View {
}
}
func popToRoot() {
profile_open = false
thread_open = false
search_open = false
}
func MainContent(damus: DamusState) -> some View {
VStack {
NavigationLink(destination: MaybeProfileView, isActive: $profile_open) {
@@ -520,6 +526,7 @@ struct ContentView: View {
}
func switch_timeline(_ timeline: Timeline) {
self.popToRoot()
NotificationCenter.default.post(name: .switched_timeline, object: timeline)
if timeline == self.selected_timeline {