Skip to main content
FlowDrop provides event handlers that let your parent application react to workflow lifecycle events — changes, saves, errors, and execution. All events are passed via the eventHandlers option when mounting:

Workflow change events

onWorkflowChange

Called on every modification to the workflow — nodes added/removed/moved, edges changed, config updated.
The changeType parameter tells you exactly what changed: Example: Track changes for analytics

onWorkflowLoad

Called after a workflow is loaded and initialized. Fires on both initial load and subsequent loads.
Example: Set up external state

onDirtyStateChange

Called when the workflow transitions between saved and unsaved states.
Example: Unsaved changes indicator

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.
Example: Confirm before saving

onAfterSave

Called after a successful save. The workflow may include server-assigned IDs or updated timestamps.
Example: Show success notification

onSaveError

Called when a save operation fails.
Example: Report errors

Error & cleanup events

onApiError

Called on any API request failure (save, load, fetch nodes, etc.). Return true to suppress FlowDrop’s default error toast.
The operation parameter describes what failed: "save", "load", "fetchNodes", "fetchCategories", etc. Example: Custom error handling

onBeforeUnmount

Called before FlowDrop is destroyed/unmounted. Use this for cleanup or prompting to save.
Example: Warn about unsaved changes

Agent Spec execution events

These events fire during Agent Spec workflow execution.

onAgentSpecExecutionStarted

Called when an Agent Spec execution begins.

onAgentSpecExecutionCompleted

Called when execution completes successfully.

onAgentSpecExecutionFailed

Called when execution fails.

onAgentSpecNodeStatusUpdate

Called when a node’s execution status changes during a run.
Example: Track execution progress

Complete example

Here’s a full integration using all lifecycle events:

Reference

For the complete TypeScript interface, see Core Types — Event Handlers.