Skip to content

feat(sidebar): show schemas as collapsible sections in the Tables sidebar#1300

Open
luizvergennes wants to merge 6 commits into
TableProApp:mainfrom
luizvergennes:main
Open

feat(sidebar): show schemas as collapsible sections in the Tables sidebar#1300
luizvergennes wants to merge 6 commits into
TableProApp:mainfrom
luizvergennes:main

Conversation

@luizvergennes
Copy link
Copy Markdown

solves #1296

Adds a Sidebar group in the settings, with a "Display schemas on the sidebar" option:
image

Enabling this option, shows all schemas on the sidebar, and they can be expanded:
image
image
image

✨ Used AI to help me create this PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@luizvergennes
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA.

github-actions Bot added a commit that referenced this pull request May 16, 2026
Signed-off-by: Luiz Vergennes <luizvergennes@lgvm.dev>
@luizvergennes
Copy link
Copy Markdown
Author

I do feel it could still be expanded a bit, to allow the tabs to also work across, schemas. I did not test, on my build. But on the production app, the tabs close as soon as I switch to another schema.

@datlechin
Copy link
Copy Markdown
Member

Thank you. The PR looks good, but it needs some improvement. I’ll continue to improve it.

@datlechin
Copy link
Copy Markdown
Member

Found one more bug while testing the branch: clicking a table in a non-current schema (e.g. `auth.audit_log_entries` while connected to `public`) errored with `relation "audit_log_entries" does not exist` because the SELECT was unqualified.

Root cause: `onDoubleClick` → `openTableTab(tableName)` only passed the table name, never the schema. `tableContext.schemaName` was being set to the connection's current schema, and the SELECT was built without the schema prefix. The PR's earlier attempt to fix this by calling `switchSchema` before opening was brittle (mutates connection-wide state, races with other tabs, fails silently for drivers without `SchemaSwitchable`).

Deeply correct fix in 12b20b8 on `pr-1300-review-fixes`:

  • `openTableTab` gains a `schema: String?` parameter
  • Threads schema through `addTableTab` / `addPreviewTableTab` / `buildBaseTableQuery` (the SQL builder already supported it)
  • Sidebar callback passes `table.schema` directly
  • Fast-path tab match now compares schema too (so opening `auth.users` and `public.users` correctly creates separate tabs instead of reusing)
  • `handleTableOpen` schema-switch hack removed entirely - it's now just `onDoubleClick?(table)`

Result: SELECT is built as `SELECT * FROM "auth"."audit_log_entries" LIMIT 1000` regardless of which schema the connection is currently pointed at. No connection-state mutation, no schema thrashing across windows.

@luizvergennes
Copy link
Copy Markdown
Author

Merged your fix into mine! Thank you so much for your help/work! 🙌

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.

2 participants