fix: add WAL mode for session SQLite to prevent 'database is locked', persist active account tab in localStorage
This commit is contained in:
+4
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user