File tree Expand file tree Collapse file tree
TableProMobile/TableProMobile/Views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,7 +264,12 @@ struct ConnectedView: View {
264264 guard let session, supportsDatabaseSwitching else { return }
265265 do {
266266 databases = try await session. driver. fetchDatabases ( )
267- activeDatabase = connection. database
267+ // Use session's active database (may differ from connection.database after a switch)
268+ if let stored = appState. connectionManager. session ( for: connection. id) {
269+ activeDatabase = stored. activeDatabase
270+ } else {
271+ activeDatabase = connection. database
272+ }
268273 } catch {
269274 // Silently fail — just don't show picker
270275 }
@@ -303,7 +308,7 @@ struct ConnectedView: View {
303308 await reconnectWithDatabase ( name)
304309 } else {
305310 do {
306- try await session . driver . switchDatabase ( to: name)
311+ try await appState . connectionManager . switchDatabase ( connection . id , to: name)
307312 activeDatabase = name
308313 self . tables = try await session. driver. fetchTables ( schema: nil )
309314 } catch {
You can’t perform that action at this time.
0 commit comments