App state cleanups: stale-closure save, silent localStorage failure, missing default key #44

Open
opened 2026-07-17 03:08:54 +00:00 by claude-bot · 0 comments
Contributor
  1. App.jsx:333-422: the first-save path builds loadedState from the effect's closed-over state; edits made while the initial fetch is in flight are omitted from the persisted snapshot. Read from a stateRef.current (kept in sync via effect) at save time instead.
  2. App.jsx:165-168: localStorage persistence failures are swallowed (catch {}); surface a one-time banner so localStorage-only users know persistence stopped.
  3. App.jsx:95-97: add circuitWholeHomeExclusions: {} to DEFAULT_STATE alongside its three sibling maps (call sites currently guard with || {}).

Acceptance criteria

  • Saved snapshot reflects edits made during initial home load
  • Storage failure produces a visible one-time warning
  • All four circuit maps defaulted consistently

(Audit finding F-24, 2026-07-16 — Severity: Low, Confidence: Medium)

1. `App.jsx:333-422`: the first-save path builds `loadedState` from the effect's closed-over `state`; edits made while the initial fetch is in flight are omitted from the persisted snapshot. Read from a `stateRef.current` (kept in sync via effect) at save time instead. 2. `App.jsx:165-168`: localStorage persistence failures are swallowed (`catch {}`); surface a one-time banner so localStorage-only users know persistence stopped. 3. `App.jsx:95-97`: add `circuitWholeHomeExclusions: {}` to DEFAULT_STATE alongside its three sibling maps (call sites currently guard with `|| {}`). **Acceptance criteria** - [ ] Saved snapshot reflects edits made during initial home load - [ ] Storage failure produces a visible one-time warning - [ ] All four circuit maps defaulted consistently *(Audit finding F-24, 2026-07-16 — Severity: Low, Confidence: Medium)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/BatteryStorageCalculator#44
No description provided.