1
0
mirror of git://jb55.com/damus synced 2024-09-19 19:46:51 +00:00

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 {

View File

@ -16,6 +16,8 @@ struct RelayDetailView: View {
@State var conn_color: Color
@Environment(\.dismiss) var dismiss
func FieldText(_ str: String?) -> some View {
Text(str ?? "No data available")
}
@ -64,6 +66,9 @@ struct RelayDetailView: View {
ProgressView()
}
}
.onReceive(handle_notify(.switched_timeline)) { notif in
dismiss()
}
.navigationTitle(nip11?.name ?? "")
.task {
var urlString = relay.replacingOccurrences(of: "wss://", with: "https://")