Merge pull request #2893 from wbkd/fix/handle-connectable

fix(handles): check if handle is connectable closes #2869
This commit is contained in:
Moritz Klack
2023-03-06 15:33:53 +01:00
committed by GitHub
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
---
'@reactflow/core': major
'@reactflow/core': patch
---
track modifier keys on useKeypress
+5
View File
@@ -0,0 +1,5 @@
---
'@reactflow/core': patch
---
fix: check if handle is connectable
+3 -2
View File
@@ -104,9 +104,10 @@ export function isValidHandle(
// in strict mode we don't allow target to target or source to source connections
const isValid =
connectionMode === ConnectionMode.Strict
handleToCheck.classList.contains('connectable') &&
(connectionMode === ConnectionMode.Strict
? (isTarget && handleType === 'source') || (!isTarget && handleType === 'target')
: handleNodeId !== fromNodeId || handleId !== fromHandleId;
: handleNodeId !== fromNodeId || handleId !== fromHandleId);
if (isValid) {
result.isValid = isValidConnection(connection);