Skip to content

Commit

Permalink
Fix issue regarding maximum stack reached
Browse files Browse the repository at this point in the history
  • Loading branch information
alhassanalbadri committed Dec 4, 2024
1 parent d231b41 commit 3adbc35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 4 additions & 1 deletion components/CustomEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ const CustomEdge: React.FC<CustomEdgeProps> = ({
}, [isSelected, edge, onDeleteEdge, setSelectedEdgeId, isEditing]);

useEffect(() => {

window.addEventListener('keydown', handleKeyDownDelete);
return () => window.removeEventListener('keydown', handleKeyDownDelete);
}, [isSelected, edge, onDeleteEdge, setSelectedEdgeId, isEditing, handleKeyDownDelete]);
Expand All @@ -202,6 +201,10 @@ const CustomEdge: React.FC<CustomEdgeProps> = ({
return null;
}

if(!sourceX || !sourceY || !targetX || !targetY) {
return null;
}

const isSelfConnection = edge ? edge.source === edge.target : false;

const calculatePathData = () => {
Expand Down
6 changes: 0 additions & 6 deletions components/FSMHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,6 @@ const FlowEditor = () => {
padding: 0,
}}
onMouseDown={(event) => handleNodeDragStart(event, node.id)}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
handleNodeDragStart(event as unknown as React.MouseEvent, node.id);
}
}}
aria-label={`Draggable node: ${node.data.label}`}
>
<CustomNode
Expand Down

0 comments on commit 3adbc35

Please sign in to comment.