Always use latest version of onConnectEnd & isValidConnection in Handle/ReconnectAnchors

This commit is contained in:
peterkogo
2026-02-10 16:02:43 +01:00
parent 7813d07345
commit 45a4a977c5
4 changed files with 10 additions and 19 deletions

View File

@@ -53,12 +53,10 @@ export function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({
const {
autoPanOnConnect,
domNode,
isValidConnection,
connectionMode,
connectionRadius,
lib,
onConnectStart,
onConnectEnd,
cancelConnection,
nodeLookup,
rfId: flowId,
@@ -93,10 +91,10 @@ export function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({
flowId,
cancelConnection,
panBy,
isValidConnection,
isValidConnection: (...args) => store.getState().isValidConnection?.(...args) ?? true,
onConnect: onConnectEdge,
onConnectStart: _onConnectStart,
onConnectEnd,
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
onReconnectEnd: _onReconnectEnd,
updateConnection,
getTransform: () => store.getState().transform,

View File

@@ -142,10 +142,10 @@ function HandleComponent(
panBy: currentStore.panBy,
cancelConnection: currentStore.cancelConnection,
onConnectStart: currentStore.onConnectStart,
onConnectEnd: currentStore.onConnectEnd,
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
updateConnection: currentStore.updateConnection,
onConnect: onConnectExtended,
isValidConnection: isValidConnection || currentStore.isValidConnection,
isValidConnection: isValidConnection || ((...args) => store.getState().isValidConnection?.(...args) ?? true),
getTransform: () => store.getState().transform,
getFromHandle: () => store.getState().connection.fromHandle,
autoPanSpeed: currentStore.autoPanSpeed,