refactor(sidebar): replace schema-grouped tree with picker footer (TablePlus pattern)#1308
Merged
Conversation
…p, schema serialisation, comment cleanup
…onnection context
…inates lossy decomposition
…ker footer matching TablePlus UX
…cker footer matching HIG
…bar footer is sole schema entry
…abaseManager.switchSchema
…onflict resolution
… list, explicit event observation, tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layers on top of the merged #1300 to address bugs and replace the schema-grouped tree UX with a TablePlus-style schema picker footer. Original work on #1307 was opened against pre-#1300 main; this is the version rebased onto current main.
Why this refactor
#1300 added schemas-as-collapsible-sections in the sidebar tree. Real issues from testing:
What this PR does
Replaces the tree with a TablePlus-style picker footer:
`SchemaPickerFooter` at sidebar bottom — native `NSPopUpButton(pullsDown: true)` via `NSViewRepresentable`. Real HIG bezel, chevron-on-right, opens upward as a real `NSMenu`. System schemas hidden by default; "Show System Schemas" toggle menu item. Footer hidden when ≤ 1 schema or driver doesn't support schemas.
Sidebar shows ONE active schema at a time — flat by capability (Tables / Views / Procedures / Functions), same as today's flat mode.
DatabaseSwitcher popover loses its schema mode — used to have a segmented control toggling Databases/Schemas. Databases-only now; schemas live in the picker footer.
`AppEvents.currentSchemaChanged: PassthroughSubject<UUID, Never>` fired centrally in `DatabaseManager.switchSchema`. All four callers (MCP bridge, TabRouter, coordinator, picker footer) get consistent observer notification. `SchemaService.handleSchemaSwitch` listens and invalidates + reloads.
Fixes the bugs PR #1300 had:
Cross-schema SELECT qualifies properly. `openTableTab(_ table: TableInfo)` canonical entry forwards to `addTableTab(name, schema:, ...)` → `QueryTab.buildBaseTableQuery(schemaName:)` → qualified SQL. Three click paths fixed: double-click (`onDoubleClick`), single-click (`TableSelectionAction.navigate(table: TableInfo)`), new-window (`EditorTabPayload` → `SessionStateFactory`).
Tab title shows `schema.tableName` only when schema differs from the connection's default schema. `users` from `public` stays clean; `auth.audit_log_entries` shows the schema for disambiguation.
TableInfo identity preserved. `PluginDriverAdapter.fetchTables()` doesn't apply schema fallback (preserves nil-passthrough). Only `fetchTables(schema:)` does.
`TableSelectionAction.navigate(table: TableInfo)` carries the whole value instead of decomposing — eliminates the bug class.
Deletions
Net: substantial code reduction. Architecture simplifies because there's now ONE schema model (current = active) instead of two (current + visible-in-tree).
CLAUDE.md compliance
Test plan