refactor(edge-renderer): work with edge ids instead of edges, like node renderer

This commit is contained in:
moklick
2023-12-17 13:53:07 +01:00
parent 2bc02547f6
commit 4316e23309
15 changed files with 300 additions and 269 deletions
+5 -1
View File
@@ -24,7 +24,10 @@ const getInitialState = ({
fitView?: boolean;
} = {}): ReactFlowStore => {
const nodeLookup = new Map();
const connectionLookup = updateConnectionLookup(new Map(), edges);
const connectionLookup = new Map();
const edgeLookup = new Map();
updateConnectionLookup(connectionLookup, edgeLookup, edges);
const nextNodes = adoptUserProvidedNodes(nodes, nodeLookup, {
nodeOrigin: [0, 0],
elevateNodesOnSelect: false,
@@ -47,6 +50,7 @@ const getInitialState = ({
nodes: nextNodes,
nodeLookup,
edges: edges,
edgeLookup,
connectionLookup,
onNodesChange: null,
onEdgesChange: null,