#67 · Fix: redo after undo showed a server moment twice
- timeline-app
- pull request
On a **server** timeline, if you edit a moment, undo, then redo, the edited moment counts as a *new* moment: the event count reads 1,001 of 1,000, and it shows as "2 moments" beside the server's own copy. This lasts until you save. Saving still writes the right data, because changes are keyed by ID. **Cause:** - Undo puts the saved moment back, so `RemoteWorkspace` drops the change. - With the dialog closed, the next render's `evict()` drops the moment and its saved original, since nothing references it. - Redo then `put`s the edit with no known original, so it's recorded as an addition (no `before`), and the overlay doesn't hide the server's copy. Durations have the same eviction path. **Fix:** - `evict()` takes the moments and durations the undo/redo history still refers to, and keeps them loaded with their originals. - The editor passes them from `history` and `future`. **Tests:** - `test/remote-cache.test.mjs` replays load → edit → undo → evict → redo. With the history retained, the redo keeps its `before`; without it, the old behaviour shows up as an addition. - End to end on the platform (Next.js + PostgreSQL, Chromium), via the UI benchmark harness: after redo the count stays 1,000 with one renamed marker, and saving stores 1,000 rows. - Unit tests pass (200), and the Chromium browser suite passes. Found while building the UI benchmarks for #51.
Sources
Open #67 · Fix: redo after undo showed a server moment twice in the timeline