MiddlewareHelpers
Helper functions for checking what changed during middleware execution. These helpers track all cumulative changes from the initial state update and all previous middlewares.
Properties
Section titled “Properties”anyEdgesAdded()
Section titled “anyEdgesAdded()”anyEdgesAdded: () =>
boolean
Checks if any edges were added.
Returns
Section titled “Returns”boolean
true if at least one edge was added by the initial state update or any previous middleware
anyEdgesRemoved()
Section titled “anyEdgesRemoved()”anyEdgesRemoved: () =>
boolean
Checks if any edges were removed.
Returns
Section titled “Returns”boolean
true if at least one edge was removed by the initial state update or any previous middleware
anyNodesAdded()
Section titled “anyNodesAdded()”anyNodesAdded: () =>
boolean
Checks if any nodes were added.
Returns
Section titled “Returns”boolean
true if at least one node was added by the initial state update or any previous middleware
anyNodesRemoved()
Section titled “anyNodesRemoved()”anyNodesRemoved: () =>
boolean
Checks if any nodes were removed.
Returns
Section titled “Returns”boolean
true if at least one node was removed by the initial state update or any previous middleware
checkIfAnyEdgePropsChanged()
Section titled “checkIfAnyEdgePropsChanged()”checkIfAnyEdgePropsChanged: (
props) =>boolean
Checks if any edge has one or more of the specified properties changed.
Parameters
Section titled “Parameters”string[]
Array of property names to check (e.g., [‘sourcePosition’, ‘targetPosition’])
Returns
Section titled “Returns”boolean
true if any edge has any of these properties modified by the initial state update or any previous middleware
checkIfAnyNodePropsChanged()
Section titled “checkIfAnyNodePropsChanged()”checkIfAnyNodePropsChanged: (
props) =>boolean
Checks if any node has one or more of the specified properties changed.
Parameters
Section titled “Parameters”string[]
Array of property names to check (e.g., [‘position’, ‘size’])
Returns
Section titled “Returns”boolean
true if any node has any of these properties modified by the initial state update or any previous middleware
checkIfEdgeAdded()
Section titled “checkIfEdgeAdded()”checkIfEdgeAdded: (
id) =>boolean
Checks if a specific edge was added.
Parameters
Section titled “Parameters”string
The edge ID to check
Returns
Section titled “Returns”boolean
true if the edge was added by the initial state update or any previous middleware
checkIfEdgeChanged()
Section titled “checkIfEdgeChanged()”checkIfEdgeChanged: (
id) =>boolean
Checks if a specific edge has been modified.
Parameters
Section titled “Parameters”string
The edge ID to check
Returns
Section titled “Returns”boolean
true if the edge was modified (any property changed) by the initial state update or any previous middleware
checkIfEdgeRemoved()
Section titled “checkIfEdgeRemoved()”checkIfEdgeRemoved: (
id) =>boolean
Checks if a specific edge was removed.
Parameters
Section titled “Parameters”string
The edge ID to check
Returns
Section titled “Returns”boolean
true if the edge was removed by the initial state update or any previous middleware
checkIfNodeAdded()
Section titled “checkIfNodeAdded()”checkIfNodeAdded: (
id) =>boolean
Checks if a specific node was added.
Parameters
Section titled “Parameters”string
The node ID to check
Returns
Section titled “Returns”boolean
true if the node was added by the initial state update or any previous middleware
checkIfNodeChanged()
Section titled “checkIfNodeChanged()”checkIfNodeChanged: (
id) =>boolean
Checks if a specific node has been modified.
Parameters
Section titled “Parameters”string
The node ID to check
Returns
Section titled “Returns”boolean
true if the node was modified (any property changed) by the initial state update or any previous middleware
checkIfNodeRemoved()
Section titled “checkIfNodeRemoved()”checkIfNodeRemoved: (
id) =>boolean
Checks if a specific node was removed.
Parameters
Section titled “Parameters”string
The node ID to check
Returns
Section titled “Returns”boolean
true if the node was removed by the initial state update or any previous middleware
getAddedEdges()
Section titled “getAddedEdges()”getAddedEdges: () =>
Edge<object>[]
Gets all edges that were added.
Returns
Section titled “Returns”Edge<object>[]
Array of edge instances that were added by the initial state update or any previous middleware
getAddedNodes()
Section titled “getAddedNodes()”getAddedNodes: () =>
Node[]
Gets all nodes that were added.
Returns
Section titled “Returns”Node[]
Array of node instances that were added by the initial state update or any previous middleware
getAffectedEdgeIds()
Section titled “getAffectedEdgeIds()”getAffectedEdgeIds: (
props) =>string[]
Gets all edge IDs that have one or more of the specified properties changed.
Parameters
Section titled “Parameters”string[]
Array of property names to check (e.g., [‘sourcePosition’, ‘targetPosition’])
Returns
Section titled “Returns”string[]
Array of edge IDs that have any of these properties modified by the initial state update or any previous middleware
getAffectedNodeIds()
Section titled “getAffectedNodeIds()”getAffectedNodeIds: (
props) =>string[]
Gets all node IDs that have one or more of the specified properties changed.
Parameters
Section titled “Parameters”string[]
Array of property names to check (e.g., [‘position’, ‘size’])
Returns
Section titled “Returns”string[]
Array of node IDs that have any of these properties modified by the initial state update or any previous middleware
getRemovedEdges()
Section titled “getRemovedEdges()”getRemovedEdges: () =>
Edge<object>[]
Gets all edges that were removed.
Uses initialEdgesMap to access the removed instances.
Returns
Section titled “Returns”Edge<object>[]
Array of edge instances that were removed by the initial state update or any previous middleware
getRemovedNodes()
Section titled “getRemovedNodes()”getRemovedNodes: () =>
Node[]
Gets all nodes that were removed.
Uses initialNodesMap to access the removed instances.
Returns
Section titled “Returns”Node[]
Array of node instances that were removed by the initial state update or any previous middleware