Skip to content

Feat/mos 0011#16

Merged
Lidizz merged 4 commits into
mainfrom
feat/MOS-0011
Feb 28, 2026
Merged

Feat/mos 0011#16
Lidizz merged 4 commits into
mainfrom
feat/MOS-0011

Conversation

@Lidizz
Copy link
Copy Markdown
Owner

@Lidizz Lidizz commented Feb 28, 2026

No description provided.

Lidizz added 4 commits March 1, 2026 00:15
- Generic hook for persisting state to session/localStorage
- Lazy initialiser reads stored value on mount
- Handles corrupt JSON gracefully (removes + falls back)
- Handles storage-full errors silently
- Defaults to sessionStorage (clears on tab close)
- SimulationContext uses usePersistedState for investments, results,
  lastRequest, and timeframe (sessionStorage, cleared on tab close)
- useSimulation reads/writes context instead of local useState;
  transient state (isSimulating, simulationError) stays local
- InvestmentBuilder reads investments from context (survives nav)
- InvestmentBuilder tests wrapped with SimulationProvider
- All 90 tests pass, build clean
- 8 tests for usePersistedState: initial value, read/write storage,
  updater function, object serialisation, corrupt data handling,
  localStorage variant, default sessionStorage
- 9 tests for SimulationContext: default state, missing provider guard,
  state updates, clearResults, sessionStorage persistence, restore on
  remount
- Total: 107 tests passing (was 90)
@Lidizz Lidizz merged commit fbcfd61 into main Feb 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant