Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lib/components/SettingsDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,9 @@
settings.multiConnection === true,
() => {
settings = updateSettings({ multiConnection: settings.multiConnection !== true });
if (!settings.multiConnection) void import('@tauri-apps/api/core').then(({ invoke }) => invoke('close_parked', { key: null })).catch(() => {});
// The shell closes the kept databases and drops them from the tab bar
// and the status bar; only it knows which ones are open.
if (!settings.multiConnection) window.dispatchEvent(new CustomEvent('stroke:multi-connection-off'));
},
)}
{/if}
Expand Down
15 changes: 14 additions & 1 deletion src/lib/components/StudioShell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8370,17 +8370,30 @@ let rowSearch = $state('')
}

/** Labs: close every open database at once (the dialog's Disconnect all). */
async function handleDisconnectAll() {
/** Close every kept database; the one on screen stays. */
async function closeKeptSessions() {
try {
const { invoke } = await import('@tauri-apps/api/core')
await invoke('close_parked', { key: null, connection: null })
} catch { /* the pools close with the app anyway */ }
_sessions.clear()
sessionOrder = []
sessionsTick++
}

async function handleDisconnectAll() {
await closeKeptSessions()
await handleDisconnect()
}

// Labs turned off in Settings: the other open databases close, so the tab
// bar and the status bar go back to the one connection on screen.
$effect(() => {
const on = () => { void closeKeptSessions() }
window.addEventListener('stroke:multi-connection-off', on)
return () => window.removeEventListener('stroke:multi-connection-off', on)
})

/**
* A saved connection was deleted (sidebar or connection modal). Deleting the
* one that is open also ends its session: staying connected to a connection
Expand Down
Loading