@@ -12,6 +12,7 @@ struct ConnectionListView: View {
1212 @State private var showingAddConnection = false
1313 @State private var editingConnection : DatabaseConnection ?
1414 @State private var selectedConnection : DatabaseConnection ?
15+ @State private var navigationPath = NavigationPath ( )
1516 @State private var showingGroupManagement = false
1617 @State private var showingTagManagement = false
1718 @State private var filterTagId : UUID ?
@@ -31,17 +32,19 @@ struct ConnectionListView: View {
3132
3233 var body : some View {
3334 NavigationSplitView {
34- sidebar
35- . navigationTitle ( " Connections " )
36- . navigationDestination ( for: DatabaseConnection . self) { connection in
37- ConnectedView ( connection: connection)
38- }
39- . onChange ( of: appState. pendingConnectionId) { _, newId in
40- navigateToPendingConnection ( newId)
41- }
42- . onAppear {
43- navigateToPendingConnection ( appState. pendingConnectionId)
44- }
35+ NavigationStack ( path: $navigationPath) {
36+ sidebar
37+ . navigationTitle ( " Connections " )
38+ . navigationDestination ( for: DatabaseConnection . self) { connection in
39+ ConnectedView ( connection: connection)
40+ }
41+ }
42+ . onChange ( of: appState. pendingConnectionId) { _, newId in
43+ navigateToPendingConnection ( newId)
44+ }
45+ . onAppear {
46+ navigateToPendingConnection ( appState. pendingConnectionId)
47+ }
4548 . toolbar {
4649 ToolbarItemGroup ( placement: . topBarTrailing) {
4750 filterMenu
@@ -245,6 +248,7 @@ struct ConnectionListView: View {
245248 private func navigateToPendingConnection( _ id: UUID ? ) {
246249 guard let id,
247250 let connection = appState. connections. first ( where: { $0. id == id } ) else { return }
251+ navigationPath. append ( connection)
248252 selectedConnection = connection
249253 appState. pendingConnectionId = nil
250254 }
0 commit comments