Skip to content

feat: add option to group all connection tabs in one window#546

Merged
datlechin merged 2 commits intomainfrom
feat/group-all-connection-tabs
Apr 1, 2026
Merged

feat: add option to group all connection tabs in one window#546
datlechin merged 2 commits intomainfrom
feat/group-all-connection-tabs

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Adds Settings > Tabs > Group all connections in one window toggle (default: off)
  • When enabled, all native macOS window tabs share one tab group regardless of connection, instead of separate windows per connection
  • Fixes multiple related bugs: cross-connection tab destruction on database switch, connection failure nuking all windows, tab title flashing to "SQL Query" after query execution, crash on window close (NSWindowStackController assertion)

Changes

New feature

  • TabSettings.groupAllConnectionTabs — new boolean setting with Codable backward compatibility
  • TabbingIdentifierResolver — returns shared "com.TablePro.main" when groupAll is ON
  • AppDelegate+WindowConfig — normalizes all existing windows' tabbingIdentifier when groupAll is ON; skips orderOut for windows in active tab groups to prevent NSWindowStackController crash
  • ConnectionSwitcherPopover — uses openNativeTab path when groupAll is ON instead of forcing separate window
  • AppDelegate+ConnectionHandler / AppDelegate+FileOpen — skip allowsAutomaticWindowTabbing = false when groupAll is ON
  • Settings UI toggle + docs + CHANGELOG

Bug fixes (apply regardless of groupAll setting)

  • closeSiblingNativeWindows() now filters by connectionId — prevents closing other connections' tabs during database switch
  • openTableTab sibling search now filters by connection ownership — prevents false-positive matches across connections with same table name
  • openPreviewTab now reuses non-preview table tabs with no active work + empty query tabs — prevents orphaned "SQL Query" tabs
  • WelcomeViewModel / ConnectionFormView connection failure handlers now close only the failing connection's windows via WindowLifecycleMonitor, not all main windows
  • connectFromDock failure handler scoped to failing connection's windows
  • executeQueryInternal / applyMultiStatementResults preserve tableName for table tabs instead of re-extracting from SQL (fixes title fallback to "SQL Query" when regex fails on schema-qualified identifiers)
  • configureWindow in MainContentView respects groupAllConnectionTabs for tabbingIdentifier

Tests

  • 2 new tests for TabbingIdentifierResolver.resolve(groupAllConnections: true)

Test plan

  • Enable "Group all connections in one window" in Settings > Tabs
  • Connect to db1, then open db2 via connection switcher — both should appear as tabs in the same window
  • Click tables in db2 sidebar — title should show table name (not "SQL Query")
  • Navigate tables with keyboard up/down — title should always show the correct table name
  • Make unsaved changes, click another table — should open new tab (not replace)
  • Switch database via Cmd+K — should only close tabs from current connection, not others
  • Close a connection that fails during query — should not close other connections' tabs
  • Disable the setting — connections should open in separate windows again
  • Open connection via deeplink — should respect the groupAll setting

@datlechin datlechin merged commit e71869b into main Apr 1, 2026
2 checks passed
@datlechin datlechin deleted the feat/group-all-connection-tabs branch April 1, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant