Skip to content

Commit 63bad40

Browse files
authored
fix: query tab title incorrectly shows table name after execution (#668) (#670)
Root cause: updateWindowTitleAndFileState() used tab.tableName as the window title for ALL tab types. After executing SELECT * FROM users, tableName="users" was set (correct for edit support), but the window title also became "users" instead of "Query 1". This caused sidebar "open table" to match the query tab's window by title, switching to it instead of opening a new table tab. Fix: only use tableName as window title for .table tabs. For .query tabs, use tab.title (the stable display name like "Query 1").
1 parent d1b8842 commit 63bad40

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

TablePro/Views/Main/Extensions/MainContentView+Setup.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ extension MainContentView {
161161
} else {
162162
let langName = PluginManager.shared.queryLanguageName(for: connection.type)
163163
let queryLabel = "\(langName) Query"
164-
windowTitle = selectedTab?.tableName
164+
windowTitle = (selectedTab?.tabType == .table ? selectedTab?.tableName : nil)
165+
?? selectedTab?.title
165166
?? (tabManager.tabs.isEmpty ? connection.name : queryLabel)
166167
}
167168
viewWindow?.representedURL = selectedTab?.sourceFileURL

0 commit comments

Comments
 (0)