Flow Studio
Undo/Redo History Overview
The canvas undo/redo system is implemented as a Zustand middleware that wraps workflowStore. Graph mutations push snapshots onto the undo stack. Ctrl+Z pops the stack; Ctrl+Y re-applies. Config form edits and viewport changes are not tracked.
What Is Tracked
| Action | Tracked? |
|---|---|
| Add node | Yes |
| Remove node | Yes |
| Move node (drag end) | Yes |
| Rename node | Yes |
| Add edge | Yes |
| Remove edge | Yes |
| Config form edits | No — saved directly |
| Viewport pan / zoom | No |
| Mode transitions | No |
| Execution state updates | No |
How It Works
// The history middleware intercepts tracked mutations:
// 1. Before the mutation: take a snapshot of { nodes, edges }
// 2. Push snapshot onto the undo stack
// 3. Apply the mutation (workflowStore state changes)
// 4. Clear the redo stack (new action invalidates redos)
// Undo (Ctrl+Z):
// 1. Pop the undo stack → get previous snapshot
// 2. Push current state to redo stack
// 3. Restore workflowStore.nodes and .edges from snapshot
// Redo (Ctrl+Y):
// 1. Pop the redo stack → get next snapshot
// 2. Push current state to undo stack
// 3. Restore workflowStore.nodes and .edges from snapshot
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| Ctrl+Z / Cmd+Z | Undo last tracked action |
| Ctrl+Y / Cmd+Shift+Z | Redo last undone action |
Config form edits are not undoable. When a user changes a node's settings in the right-panel config form, those changes are auto-saved immediately. Ctrl+Z on the canvas will not revert config changes — it only reverts canvas graph mutations (add/remove/move nodes and edges).