chore: format auth code and update runtime

This commit is contained in:
2026-07-29 22:11:08 -04:00
parent 892479dceb
commit 22e6e721a7
9 changed files with 132 additions and 73 deletions
+6 -2
View File
@@ -409,7 +409,8 @@ function autosave() {
clearTimeout(autosave._t);
autosave._t = setTimeout(() => {
try {
if (storageKey) localStorage.setItem(storageKey, JSON.stringify(state.plan));
if (storageKey)
localStorage.setItem(storageKey, JSON.stringify(state.plan));
// Local storage is namespaced per authenticated account; the account copy is authoritative when online.
if (navigator.onLine && csrfToken()) {
const method = remotePlanId ? "PUT" : "POST";
@@ -455,7 +456,10 @@ function loadFromStorage(userId) {
// A shared browser must never retain a previous account's local-only draft.
for (let i = localStorage.length - 1; i >= 0; i--) {
const key = localStorage.key(i);
if ((key?.startsWith(`${STORAGE_PREFIX}:`) && key !== storageKey) || key === "roastPlannerPlan.v1")
if (
(key?.startsWith(`${STORAGE_PREFIX}:`) && key !== storageKey) ||
key === "roastPlannerPlan.v1"
)
localStorage.removeItem(key);
}
const raw = localStorage.getItem(storageKey);