Skip to content

refactor: unify new tab creation — TabIntent, pendingPayloads, native tab bar fix#585

Open
datlechin wants to merge 7 commits intomainfrom
refactor/unified-tab-creation
Open

refactor: unify new tab creation — TabIntent, pendingPayloads, native tab bar fix#585
datlechin wants to merge 7 commits intomainfrom
refactor/unified-tab-creation

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Replace race-prone pendingConnectionId singleton with pendingPayloads dictionary (payload ID → connection ID) — supports parallel window opens without races
  • Add TabIntent enum (.openContent, .newEmptyTab, .restoreOrDefault) to EditorTabPayload, replacing overlapping isNewTab / isConnectionOnly semantics
  • Fix native macOS tab bar "+" button via newWindowForTab: override on AppDelegate
  • Unify all 6 direct openWindow(id: "main", ...) call sites through WindowOpener.openNativeTab()
  • Intent-based routing in SessionStateFactory and initializeAndRestoreTabs — clean switch instead of fragile fallthrough
  • Remove 100ms + 50ms timing hacks in tab restore (no longer needed with set-based tracking)
  • Fix ghost toolbar pill: set isTableTab = true in factory for .table payloads
  • Fix sidebar empty flash: show loading spinner when connection is active but tables haven't loaded yet
  • Resolve session synchronously for nil-payload windows (native tab bar creates ContentView(payload: nil))

Test plan

  • Cmd+T opens new empty query tab in correct tab group
  • Toolbar "+" button: same behavior as Cmd+T
  • Native tab bar "+" button: creates proper new tab (was broken before — created invisible orphan)
  • Open table (double-click sidebar): opens in new tab with correct toolbar state
  • Connect from Welcome window: window opens with correct tab group
  • Connect from Dock menu: same
  • Connection Switcher: switching connections opens in correct window/tab group
  • Tab restore on app launch: all tabs restore without timing-dependent flicker
  • Rapid Cmd+T: multiple tabs opened quickly don't race on connection assignment
  • Build succeeds: xcodebuild -scheme TablePro build -skipPackagePluginValidation

…Payloads registry

- Add TabIntent enum (.openContent, .newEmptyTab, .restoreOrDefault) to EditorTabPayload
- Replace race-prone pendingConnectionId singleton with pendingPayloads dictionary
- Add connectionId(fromWindow:) reverse lookup to WindowLifecycleMonitor
- Add WindowOpener.tabbingIdentifier(for:) static helper
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