Skip to content

Commit fa1265e

Browse files
authored
revert(core): remove defer of connection lookup update (#1799)
* revert(core): remove defer of connection lookup update Signed-off-by: braks <[email protected]> * fix(core): remove edge lookup update when updating connection lookup Signed-off-by: braks <[email protected]> * chore(changeset): add Signed-off-by: braks <[email protected]> --------- Signed-off-by: braks <[email protected]>
1 parent 47736de commit fa1265e

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

.changeset/many-donkeys-train.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vue-flow/core": patch
3+
---
4+
5+
Remove edgelookup update when updating connection lookup as edge lookup is computed already

packages/core/src/store/actions.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { zoomIdentity } from 'd3-zoom'
22
import type { ComputedRef } from 'vue'
3-
import { nextTick } from 'vue'
43
import { until } from '@vueuse/core'
54
import type {
65
Actions,
@@ -532,13 +531,9 @@ export function useActions(state: State, nodeLookup: ComputedRef<NodeLookup>, ed
532531
state.edges,
533532
)
534533

535-
nextTick(() => {
536-
state.edges = state.edges.map((edge, index) => (index === prevEdgeIndex ? validEdge : edge))
534+
state.edges = state.edges.map((edge, index) => (index === prevEdgeIndex ? validEdge : edge))
537535

538-
nextTick(() => {
539-
updateConnectionLookup(state.connectionLookup, edgeLookup.value, [validEdge])
540-
})
541-
})
536+
updateConnectionLookup(state.connectionLookup, edgeLookup.value, [validEdge])
542537

543538
return validEdge
544539
}

packages/core/src/utils/store.ts

-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ function addConnectionToLookup(
165165

166166
export function updateConnectionLookup(connectionLookup: ConnectionLookup, edgeLookup: EdgeLookup, edges: GraphEdge[]) {
167167
connectionLookup.clear()
168-
edgeLookup.clear()
169168

170169
for (const edge of edges) {
171170
const { source: sourceNode, target: targetNode, sourceHandle = null, targetHandle = null } = edge
@@ -176,8 +175,6 @@ export function updateConnectionLookup(connectionLookup: ConnectionLookup, edgeL
176175

177176
addConnectionToLookup('source', connection, targetKey, connectionLookup, sourceNode, sourceHandle)
178177
addConnectionToLookup('target', connection, sourceKey, connectionLookup, targetNode, targetHandle)
179-
180-
edgeLookup.set(edge.id, edge)
181178
}
182179
}
183180

0 commit comments

Comments
 (0)