eventHandlers option when mounting:
Workflow change events
onWorkflowChange
Called on every modification to the workflow — nodes added/removed/moved, edges changed, config updated.
changeType parameter tells you exactly what changed:
| Change Type | Triggered when |
|---|---|
node_add | A node is added to the canvas |
node_remove | A node is deleted |
node_move | A node is dragged to a new position |
node_config | A node’s configuration values change |
edge_add | A connection is drawn between nodes |
edge_remove | A connection is deleted |
metadata | Workflow metadata changes |
name | The workflow name is edited |
description | The workflow description is edited |
onWorkflowLoad
Called after a workflow is loaded and initialized. Fires on both initial load and subsequent loads.
onDirtyStateChange
Called when the workflow transitions between saved and unsaved states.
Save lifecycle events
These three events form the save lifecycle: before → after (success) or error (failure).onBeforeSave
Called before a save operation. Return false to cancel the save.
onAfterSave
Called after a successful save. The workflow may include server-assigned IDs or updated timestamps.
onSaveError
Called when a save operation fails.
Error & cleanup events
onApiError
Called on any API request failure (save, load, fetch nodes, etc.). Return true to suppress FlowDrop’s default error toast.
operation parameter describes what failed: "save", "load", "fetchNodes", "fetchCategories", etc.
Example: Custom error handling