fix: add WAL mode for session SQLite to prevent 'database is locked', persist active account tab in localStorage

This commit is contained in:
2026-06-27 15:45:05 +02:00
parent 93f2b94dd2
commit 1bd385e054
3 changed files with 20 additions and 2 deletions
+4 -2
View File
@@ -177,6 +177,7 @@ function renderAccountPanel(accountId) {
function switchAccount(accountId) {
if (state.activeAccount === accountId) return;
state.activeAccount = accountId;
localStorage.setItem("activeAccount", accountId);
// Update tabs
document.querySelectorAll(".account-tab").forEach((tab) => {
@@ -488,8 +489,9 @@ async function loadAccounts() {
// Render panels for each account
accounts.forEach((acc) => renderAccountPanel(acc.id));
// Determine active account
const activeId = state.activeAccount || accounts[0].id;
// Determine active account (persisted across reloads)
const savedId = localStorage.getItem("activeAccount");
const activeId = (savedId && accounts.some(a => a.id === savedId)) ? savedId : (state.activeAccount || accounts[0].id);
switchAccount(activeId);
// Update settings