feat: add session undo and redo
Continuous Integration / lint-and-test (push) Successful in 14s
Continuous Integration / docker-build-and-push (push) Successful in 34s

This commit is contained in:
Lucas Winther
2026-09-30 01:33:29 +02:00
parent d38584396b
commit 804f32c5fb
9 changed files with 411 additions and 14 deletions
+15
View File
@@ -101,6 +101,21 @@ uses on a first run, so "reset" and "a brand-new browser" cannot drift apart.
Both are preceded in the UI by a JSON backup download that must succeed before
the destructive write is attempted.
## Session undo and redo
The snapshot store keeps up to 50 prior saved datasets in memory. A changed
`mutate` adds one step after its write succeeds; an unchanged mutation adds
none. Undo and redo run through the same queue and persist their target dataset
before changing the visible snapshot or either history stack. A failed write
therefore leaves both the data and the available undo/redo actions intact.
Import and reset clear the stacks only after their write succeeds. They are
whole-dataset replacement flows with backup-first protection, not ordinary
undoable edits. History is not in `Dataset` or IndexedDB and vanishes on reload.
The header reads a stable history capability snapshot from the store to enable
its controls; keyboard shortcuts skip editable fields so browser text undo
still works.
## Money
A float, deliberately, with two rules that make it safe: