Skip to content

Commit 11ae09a

Browse files
authored
fix: fix infinite loop two ways (#573)
* Fix infinite loop two ways - Don't try to find connections for a block with no output/prev - If you've checked every connection and didn't find a match stop * Support connecting C shaped blocks around detached stacks
1 parent 64942a1 commit 11ae09a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/keyboard_drag_strategy.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
108108
): ConnectionCandidate | null {
109109
// @ts-expect-error getLocalConnections is private.
110110
const localConns = this.getLocalConnections(draggingBlock);
111+
if (localConns.length == 0) {
112+
return null;
113+
}
111114

112115
let candidateConnection = this.findTraversalCandidate(
113116
draggingBlock,
@@ -205,6 +208,7 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
205208
};
206209
}
207210
});
211+
if (potential == this.searchNode) break;
208212
}
209213
return candidateConnection;
210214
}

0 commit comments

Comments
 (0)