You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show an open transaction, and warn before closing a tab that has one #843
Severity: P1 (data safety: uncommitted work is rolled back without warning).
What happens
On http://localhost:1420/?mock=connected:
Run BEGIN, then UPDATE customers SET city = 'X' WHERE id = 1. The pane says "Query executed. 1 row(s) affected." Nothing in the toolbar, the tab or the status bar says a transaction is open.
Open a second tab, then close the first one with its X (or middle-click, or "Close Others" from the second tab). It closes at once with no prompt, and its server session is closed, which rolls back the open transaction.
The same happens to a tab holding unsaved SQL: it closes without a prompt, and closing the last query tab replaces its content with a blank tab.
Cause
src/stores/editorStore.ts:99-123 (closeTab), closeOtherTabs and closeTabsToRight never confirm anything.
src/lib/server-sessions.ts:64-78 (closeStale) closes the tab's session as soon as the tab disappears, or when the tab is pointed at another connection, with no check for an open transaction.
The only place the frontend learns that a transaction is open is the grid save (src/hooks/useGridSave.ts:155, outcome.transaction === "open"). No UI shows it.
Fix
Track transaction state per tab session. The backend already reports transaction: "open" from apply_grid_edits; return it from execute_query too.
Show a "Transaction open — Commit / Rollback" indicator on the tab and in the toolbar.
Before closing a tab, or re-pointing it at another connection, confirm when it has an open transaction or unsaved content.
The close-confirmation half of this issue is fixed in the next fix batch: closing a tab with unsaved SQL now asks first. That applies to Close, Close Others, Close to the Right and Ctrl+W.
The transaction half is still open, because it needs a backend change first. execute_query doesn't report whether a transaction is open; only apply_grid_edits does. Working it out in the frontend by parsing BEGIN/COMMIT wouldn't be reliable, because of autocommit=0, DDL that commits implicitly, and stored procedures. The plan:
Return the session's transaction state with each execute_query result. On MySQL that can come from @@in_transaction; on MariaDB the server status flags carry it.
Show a "Transaction open: Commit / Rollback" indicator on the tab.
Warn before closing a tab, or pointing it at another server, while its transaction is open.
Done across #908 (TX badge, Commit/Rollback, the prompt on close), #916 and #926 (the backend reports the state after success and after failure), and #922 (the prompt before pointing a tab at another connection).
Activity
EVWorth commentedon Oct 23, 2026
The close-confirmation half of this issue is fixed in the next fix batch: closing a tab with unsaved SQL now asks first. That applies to Close, Close Others, Close to the Right and Ctrl+W.
The transaction half is still open, because it needs a backend change first.
execute_querydoesn't report whether a transaction is open; onlyapply_grid_editsdoes. Working it out in the frontend by parsingBEGIN/COMMITwouldn't be reliable, because ofautocommit=0, DDL that commits implicitly, and stored procedures. The plan:execute_queryresult. On MySQL that can come from@@in_transaction; on MariaDB the server status flags carry it.Generated by Claude Code
fix(editor): confirm before closing unsaved tabs
fix(ui): grid, editor, connection and backup P1s (#856)
release: 1.4.0 (#871)
feat(editor): show an open transaction per tab
fix(ux): editor, grid and results review fixes (#908)
feat: report completed results and transaction state (#916)
fix: grid cell keys, tx switch prompt, CSV import (#922)
EVWorth commentedon Oct 30, 2026
Done across #908 (TX badge, Commit/Rollback, the prompt on close), #916 and #926 (the backend reports the state after success and after failure), and #922 (the prompt before pointing a tab at another connection).
Generated by Claude Code