FlowStateUpdate
Describes a set of changes to apply to the diagram state.
Middlewares can modify state by passing a FlowStateUpdate to the next() function.
Example
Section titled “Example”const middleware: Middleware = { name: 'auto-arranger', execute: (context, next) => { // Apply state changes next({ nodesToUpdate: [ { id: 'node1', position: { x: 100, y: 200 } }, { id: 'node2', position: { x: 300, y: 200 } } ], metadataUpdate: { viewport: { x: 0, y: 0, zoom: 1 } } }); }};Properties
Section titled “Properties”edgesToAdd?
Section titled “edgesToAdd?”
optionaledgesToAdd:Edge<object>[]
Edges to add to the diagram
edgesToRemove?
Section titled “edgesToRemove?”
optionaledgesToRemove:string[]
IDs of edges to remove from the diagram
edgesToUpdate?
Section titled “edgesToUpdate?”
optionaledgesToUpdate:Partial<Edge<object>> &object[]
Partial edge updates (only changed properties need to be specified)
metadataUpdate?
Section titled “metadataUpdate?”
optionalmetadataUpdate:Partial<Metadata<object>>
Partial metadata update (viewport, selection, etc.)
nodesToAdd?
Section titled “nodesToAdd?”
optionalnodesToAdd:Node[]
Nodes to add to the diagram
nodesToRemove?
Section titled “nodesToRemove?”
optionalnodesToRemove:string[]
IDs of nodes to remove from the diagram
nodesToUpdate?
Section titled “nodesToUpdate?”
optionalnodesToUpdate:Partial<Node> &object[]
Partial node updates (only changed properties need to be specified)