Problem
js/app.js:486,507 — both _commitReplace and _commit silently swallow localStorage errors:
try { localStorage.setItem('sim_autosave', this._lastState); } catch {}
If storage is full (5-10MB quota), autosave fails silently. User closes the browser and loses work with no warning.
Fix
Replace both sites with a one-shot toast warning:
try {
localStorage.setItem('sim_autosave', this._lastState);
this._autosaveWarned = false;
} catch {
if (!this._autosaveWarned) {
this._toast('Autosave failed. Storage may be full. Save your work via File, Export, then clear some browser data.');
this._autosaveWarned = true;
}
}
Initialize _autosaveWarned = false in the constructor (near existing boolean flags at line 25).
The flag ensures one toast per failure streak — not one per _commit call. On a successful save, the flag resets so future failures re-arm the warning.
What's NOT changed
- Library/component saves (app-library.js:101,112) already handle errors correctly with
catch { return false } + caller toast.
- Other
localStorage.setItem calls for non-critical flags (tour seen, welcome seen, MC hint, palette sections, timeline compare) — these are UI state flags where silent failure is acceptable.
Effort
~10 minutes. 1 file (js/app.js). ~12 lines changed.
Problem
js/app.js:486,507— both_commitReplaceand_commitsilently swallow localStorage errors:If storage is full (5-10MB quota), autosave fails silently. User closes the browser and loses work with no warning.
Fix
Replace both sites with a one-shot toast warning:
Initialize
_autosaveWarned = falsein the constructor (near existing boolean flags at line 25).The flag ensures one toast per failure streak — not one per
_commitcall. On a successful save, the flag resets so future failures re-arm the warning.What's NOT changed
catch { return false }+ caller toast.localStorage.setItemcalls for non-critical flags (tour seen, welcome seen, MC hint, palette sections, timeline compare) — these are UI state flags where silent failure is acceptable.Effort
~10 minutes. 1 file (
js/app.js). ~12 lines changed.