Skip to content

Commit 4f3f5a7

Browse files
committed
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
1 parent 76388be commit 4f3f5a7

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
@@ -106,6 +106,9 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
106106
private getConstrainedConnectionCandidate(
107107
draggingBlock: BlockSvg,
108108
): ConnectionCandidate | null {
109+
if (!draggingBlock.previousConnection && !draggingBlock.outputConnection) {
110+
return null;
111+
}
109112
// @ts-expect-error getLocalConnections is private.
110113
const localConns = this.getLocalConnections(draggingBlock);
111114

@@ -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)