Auto-load notes on notes workspace startup for existing sessions

This commit is contained in:
2026-03-28 19:36:37 +00:00
parent 7ecb7256de
commit 744adc8645
+24 -3
View File
@@ -504,6 +504,29 @@
writeOutput({ message: 'PocketBase session cleared.' });
}
async function bootstrapWorkspace() {
try {
const client = await ensurePocketBaseClient();
const config = await getPocketBaseConfig();
if (client.authStore?.token) {
try {
await client.collection(config.collection).authRefresh();
} catch {
}
}
await updatePbStatus();
if (client.authStore?.isValid) {
await loadNotes();
} else {
writeOutput('Login to load notes.');
}
} catch (error) {
writeOutput({ error: error?.message || String(error) });
}
}
async function loadNotes() {
await ensurePocketBaseClient();
ensureLoggedIn();
@@ -614,9 +637,7 @@
searchInput.addEventListener('input', () => renderList());
hiddenMode.addEventListener('change', () => renderList());
ensurePocketBaseClient()
.then(() => updatePbStatus())
.catch((error) => writeOutput({ error: error?.message || String(error) }));
bootstrapWorkspace();
clearForm();
renderList();
loadHealth();