Commit e366f8b
feat: implement state persistence (v0.2.0 Task #2)
Adds localStorage-based state persistence to save/restore application
state between sessions.
**New Module: Storage.res (350 lines)**
- Serializes model to JSON with proper type handling
- Saves to localStorage (key: "panll_state_v1")
- Loads on app startup
- Handles ReScript variants (viewMode, humidity, oodaPhase)
- Graceful fallback to default state if load fails
**What Gets Persisted:**
- User work: constraints, editor content, neural tokens, world content
- Preferences: view mode, pane visibility, humidity level
- Session state: vexometer index, orbital stability
**Integration:**
- App.res: Load persisted state on init
- Msg.res: Added SaveState message type
- Update.res: Auto-save after important changes
- Constraints added/removed/modified
- Editor/world content updated
- View preferences changed
- Neural tokens received
**Cleanup:**
- Removed draft files (AppNew.res, UpdateNew.res)
- Fixed unused variable warnings
- Disabled warnings 33 & 44 (unused opens) in rescript.json
**Testing:**
- All 33 tests passing in 647ms
- ReScript builds in 150ms
- No regressions
**Status:**
- rescript-tea migration: BLOCKED (incompatible with ReScript 11.x)
- Decision: Keep custom TEA (33 tests, 86.2% coverage, well-tested)
- STATE.scm updated to document blocker
Next: Manual browser testing, then Settings Management
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 84e4ee9 commit e366f8b
11 files changed
Lines changed: 362 additions & 272 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
0 commit comments