NodeChange
The onNodesChange callback takes
an array of NodeChange objects that you should use to update your flow’s state.
The NodeChange type is a union of six different object types that represent that
various ways an node can change in a flow.
export type NodeChange =
| DimensionChange
| PositionChange
| SelectionChange
| RemoveChange
| AddChange
| ReplaceChange;Variant types
DimensionChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "dimensions" | |
dimensions | Dimensions | |
resizing | boolean | |
setAttributes | boolean | "width" | "height" |
PositionChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "position" | |
position | XYPosition | |
positionAbsolute | XYPosition | |
dragging | boolean |
SelectionChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "select" | |
selected | boolean |
RemoveChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "remove" |
AddChange
| Name | Type | Default |
|---|---|---|
id | string | |
item | NodeOrEdge | |
type | "add" | |
index | number |
ReplaceChange
| Name | Type | Default |
|---|---|---|
id | string | |
item | NodeOrEdge | |
type | "replace" |