OnEdgesChange
This type is used for typing the onedgeschange handler.
export type OnEdgesChange<EdgeType extends Edge = Edge> = (changes: EdgeChangeset<EdgeType>) => void;Fields
Parameters:| Name | Type | Default |
|---|---|---|
changes | EdgeChangeset<EdgeType> |
Usage
This type accepts a generic type argument of custom edge types. See this section in our TypeScript guide for more information.
onedgeschange is called with an EdgeChangeset before Svelte Flow
applies the changes. You can inspect or edit the changeset inside the handler, and Svelte Flow applies whatever is
left afterwards:
const onedgeschange: OnEdgesChange = (changes) => {
// ignore all changes for this edge
changes.removeForEdge('e1-2');
};If you want to apply the changes yourself, use applyTo() and call clear() afterwards, so that Svelte Flow
doesn’t apply them a second time:
const onedgeschange: OnEdgesChange = (changes) => {
edges = changes.applyTo(edges);
changes.clear();
};