File tree Expand file tree Collapse file tree
TablePro/Views/Connection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -473,21 +473,26 @@ struct WelcomeWindowView: View {
473473 do {
474474 try await dbManager. connectToSession ( connection)
475475 } catch {
476- // Show error to user and re-open welcome window
477- await MainActor . run {
478- AlertHelper . showErrorSheet (
479- title: String ( localized: " Connection Failed " ) ,
480- message: error. localizedDescription,
481- window: nil
482- )
483- openWindow ( id: " welcome " )
484- }
485476 Self . logger. error (
486477 " Failed to connect: \( error. localizedDescription, privacy: . public) " )
478+ handleConnectionFailure ( error: error)
487479 }
488480 }
489481 }
490482
483+ private func handleConnectionFailure( error: Error ) {
484+ // Close the main window first so macOS doesn't merge it with the welcome window
485+ NSApplication . shared. closeWindows ( withId: " main " )
486+ openWindow ( id: " welcome " )
487+
488+ // Show error as modal — welcome window is now the only window
489+ AlertHelper . showErrorSheet (
490+ title: String ( localized: " Connection Failed " ) ,
491+ message: error. localizedDescription,
492+ window: nil
493+ )
494+ }
495+
491496 private func deleteConnection( _ connection: DatabaseConnection ) {
492497 connections. removeAll { $0. id == connection. id }
493498 storage. deleteConnection ( connection)
You can’t perform that action at this time.
0 commit comments