feat(undo-redo): unify field, code, and loop config edits into one stack by waleedlatif1 · Pull Request #4875 · simstudioai/sim
- Record block-level field edits (tools, model, prompts, dropdowns, sliders, tag/reference insertion) on the workflow undo stack - Consolidate the separate per-field code-editor stack into the workflow stack and delete it; route Cmd+Z/redo in every text editor to the workflow undo so native/editor undo is suppressed and there is one source of truth - Make loop/parallel config values (iterations, collection, condition, batch size) undoable; coalesce consecutive same-field edits into one step - Group the model->apiKey clear into a single undo step - Reveal the affected block (select + open its editor panel) on undo/redo so a reverted field change is never off-screen
Code-field undo frames are large and accumulate quickly; keeping them in the synchronous localStorage-backed stack risked main-thread jank on every keystroke and the ~5MB quota. Move the unified undo store to async IndexedDB (idb-keyval), matching how the old separate code stack was persisted. - Replace the localStorage persist adapter with a throttled IndexedDB adapter (coalesces a burst of writes into one transaction; flushes on tab hide) - Delete the now-orphaned code-storage adapter
- collaborativeBatchSetSubblockValues: capture each field's real prior value before mutating instead of recording before: update.expectedValue, which was undefined when a caller omitted expectedValue (would undo a field to undefined) - List the stable recordSubflowFieldUpdate helper in the subflow methods' dependency arrays - Document that a multi-block batch undo reveals only its first block
Base automatically changed from staging to main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters