File tree Expand file tree Collapse file tree
TablePro/Views/Main/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828- DROP TABLE and TRUNCATE TABLE sidebar operations producing no SQL for plugin-based drivers
2929- Foreign key navigation arrows not appearing after switching databases with Cmd+K on MySQL
3030- Sidebar not refreshing after creating or dropping tables
31+ - Dropping a table disconnecting the database when the dropped table's tab was active
3132
3233## [ 0.19.1] - 2026-03-16
3334
Original file line number Diff line number Diff line change @@ -225,12 +225,21 @@ extension MainContentCoordinator {
225225 }
226226
227227 if clearTableOps {
228- // Close tabs for deleted tables
228+ // Remove tabs for deleted tables
229229 if !deletedTables. isEmpty {
230- if let currentTab = tabManager. selectedTab,
231- let tableName = currentTab. tableName,
232- deletedTables. contains ( tableName) {
233- NSApp . keyWindow? . close ( )
230+ let tabIdsToRemove = Set (
231+ tabManager. tabs
232+ . filter { $0. tabType == . table && deletedTables. contains ( $0. tableName ?? " " ) }
233+ . map ( \. id)
234+ )
235+
236+ if !tabIdsToRemove. isEmpty {
237+ tabManager. tabs. removeAll { tabIdsToRemove. contains ( $0. id) }
238+ if let firstRemaining = tabManager. tabs. first {
239+ tabManager. selectedTabId = firstRemaining. id
240+ } else {
241+ tabManager. selectedTabId = nil
242+ }
234243 }
235244 }
236245
You can’t perform that action at this time.
0 commit comments