01
Treating generative edits like undoable document operations
- Problem
- Every AI edit produces a new version of the image, and users try variations constantly. Naive state — replace the image, lose the old one — makes comparison impossible and turns one bad generation into a restart.
- Decision
- The editor keeps an ordered history of image snapshots in Zustand with a lightweight thumbnail strip, so undo/redo is a pointer move, not a reconstruction. Masks are stored as their own layer and composited to a PNG at generation time, never baked into the base image.
- Tradeoff
- Snapshots use more memory than a command log would, and large images force a cap on history depth. In exchange, undo is instant and correct with zero re-render logic.
- Outcome
- Users can generate five variations, flip between them, and undo to the original without the app ever losing a version.




