Skip to content

Labs: several databases open together, one tab bar, switching in place - #260

Merged
broisnees merged 2 commits into
nightlyfrom
feat/multi-db
Nov 15, 2026
Merged

broisnees merged 2 commits into
nightlyfrom
feat/multi-db

Conversation

@broisnees

Copy link
Copy Markdown
Collaborator

Follow-up to #240 (Labs: several connections at once), from a screen recording: switching databases flickered, and tabs from the database you left disappeared.

Rust: every call names its database

  • New Db<'r> extractor (db/connection.rs) replaces State<'_, DbState> in every command. It reads a __conn key from the request payload.
  • require_conn serves a routed call from the front pool when the key matches active_key, otherwise from the pool kept aside for that key. A key whose pool was closed is an error, never a quiet run on whatever database is in front. Calls without a key behave exactly as before.
  • resume_connection and park_connection maintain active_key, and set_active_conn_key names a freshly connected pool. Up to 8 pools are kept (was 6).
  • cargo test --lib: 371 passed. Unused imports were removed with cargo fix.

App

  • api.js adds __conn to every call while a route is set (Labs only). A fresh connect clears it, so a call can never be sent to a kept database by mistake.
  • One tab bar for every open database: this database's tabs plus the kept ones, grouped in the order the databases were opened, each with a small database label. Kept databases' tabs are dimmed. Clicking one switches to that database on that tab; closing one doesn't switch. Context actions (close others, duplicate, pin) act only on the current database's tabs.
  • Switching to a kept database resumes in place: no connection = null, no welcome screen, no sidebar skeleton. The connection, sidebar (schemas, tables, active table) and tabs swap in at once, then refresh quietly in the background.
  • The tab on screen keeps its rows when set aside, so returning to it is instant. Other table tabs refetch when shown.

Checks: npm test 1795 + 10 DOM tests passed (exit 0), design lint clean, npm run check 0 errors, npm run build passed. Rust checked and tested with DuckDB linked as a prebuilt library.

🤖 Generated with Claude Code

broisnees and others added 2 commits November 15, 2026 18:35
…lace

Each call now names the database it is for (__conn, read by a new Db
extractor in place of State<DbState>), so require_conn serves it from the
front pool or the one kept aside for that database; a call sent just before
a switch still lands on its own database, and a key whose pool was closed
is an error rather than a quiet run on whatever is in front.

The page:
- One tab bar for every open database: this one's tabs and the kept ones,
  grouped in the order the databases were opened and labelled with their
  database. Clicking a kept database's tab switches there on that tab;
  closing it does not switch.
- A switch to a kept database resumes in place: its pool comes back, and
  the sidebar, tabs and the tab you were on are swapped in at once and
  refreshed quietly behind. No teardown, no welcome screen, no skeleton in
  between - the flicker.
- The tab on screen keeps its rows when set aside, so returning is instant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broisnees
broisnees merged commit 8c2d076 into nightly Nov 15, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant