Commit c3f70c9
authored
fix(studio): restore saved positions on page refresh (#801)
* fix(studio): restore saved positions on page refresh
studio-manual-edits.json was correctly persisted to disk but never read back
into memory on bootstrap. On every page refresh, studioManualEditManifestRef
started empty, so handleLoad applied an empty manifest and all saved
positions/sizes/rotations were silently discarded.
applyStudioManualEditsToPreview now reads from disk whenever the in-memory
manifest is empty. The existing readRevision guard prevents overwriting an
in-flight optimistic edit if a position change races with the disk read.
* fix(studio): close delete-all race and apply same bootstrap to motion manifest
Two follow-up fixes from review:
1. Replace edits.length === 0 with an explicit manifestBootstrappedRef boolean.
The old condition was true in two distinct states: never-bootstrapped AND
user-deleted-all-edits. Because the delete-all disk write is async-queued,
there was a window where applyStudioManualEditsToPreview could read stale
disk content and resurrect just-deleted positions. The boolean flag is set
on the first apply and reset on project switch, cleanly separating the two
states.
2. applyStudioMotionToPreview had the identical bug: GSAP motion edits were
also lost on page refresh. Applied the same motionBootstrappedRef pattern.1 parent 246a191 commit c3f70c9
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
147 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
148 | 156 | | |
149 | 157 | | |
150 | 158 | | |
| |||
210 | 218 | | |
211 | 219 | | |
212 | 220 | | |
213 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
| |||
427 | 439 | | |
428 | 440 | | |
429 | 441 | | |
| 442 | + | |
430 | 443 | | |
431 | 444 | | |
432 | 445 | | |
| |||
0 commit comments