Foblex Flow
Introduction
Overview
Nodes
Custom Nodes
Drag Handle
Node Selection
Resize Handle
Rotate Handle
Grouping
Drag to Group
Connectors
Node as Connector
Connector Inside Node
Connector Outlet
Limiting Connections
Connection Rules
Connectable Side
Updated
Connections - Editing
Drag to Connect
Drag to Reassign
Create Node on Connection Drop
Remove Connection on Drop
Assign Node to Connection on Drop
Auto Snap
Connections - Appearance
Connection Types (Straight, Segment, Bezier, Adaptive Curve)
Custom Connection Type
Connection Behaviours
Connection Markers
Connection Content
Updated
Connection Gradients
Updated
Connections - Routing
Connection Waypoints
New
Connection Connectable Side
New
Viewport
Minimap
Zoom
Background
Auto Pan
New
Canvas Layer Ordering
New
Editor Helpers
Selection Area
Magnetic Lines
New
Magnetic Rects
New
Grid System
Add Node from Palette
Help in Positioning (Legacy)
Deprecated
Layout Engines
Dagre Layout
New
Dagre Auto Layout
New
ELK.js Layout
New
ELK.js Auto Layout
New
Reflow
Reflow on Resize
New
Editor State
Cut/Copy/Paste
Undo/Redo
Undo/Redo V2
Events
Drag Start/End Events
Custom Event Triggers
Performance
Large Scene Performance
Connection Redraw Performance
Updated
Reference Apps
AI Low-Code Platform
Updated
Schema Designer
Updated
Call Center Flow
Updated
UML Diagram
Updated
Tournament Bracket
Updated
Foblex Flow

Undo/Redo v2

Description

This example demonstrates how to add undo and redo functionality to a flow-based diagram built with Foblex Flow. It uses @foblex/mutator, a lightweight state management utility for snapshots, history, and predictable state transitions.

Use this version when your editor already has enough state complexity that you want a dedicated history layer instead of ad hoc manual stacks.

Example

[example.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/advanced/undo-redo-v2/example.html [example.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/advanced/undo-redo-v2/example.ts [example.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/advanced/undo-redo-v2/example.scss

Installation

Before running this example, install the additional package:

Practical tips

  • Use @foblex/mutator whenever your editor requires time-traveling operations.
  • Keep the state flat and serializable.
  • Group multiple actions into one update() call when they should be undone as a single step.
  • Undo/redo can cover selections, canvas transforms, and custom node metadata, not only nodes and connections.

This version is a better fit for editors that already have complex state and need a more disciplined history model.

Related examples

Edit this page on GitHub