refactor(elements): render only visible elements

This commit is contained in:
moklick
2021-10-19 14:57:34 +02:00
parent 410b12946d
commit 1525af39cf
21 changed files with 376 additions and 217 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ import shallow from 'zustand/shallow';
import { useStore } from '../../store';
import NodeIdContext from '../../contexts/NodeIdContext';
import { HandleProps, Connection, ElementId, Position, Node, ReactFlowState } from '../../types';
import { HandleProps, Connection, ElementId, Position, ReactFlowState } from '../../types';
import { onMouseDown, SetSourceIdFunc, SetPosition } from './handler';
@@ -52,9 +52,9 @@ const Handle = forwardRef<HTMLDivElement, HandleComponentProps>(
const isTarget = type === 'target';
const onConnectExtended = useCallback(
(params: Connection, nodes: Node[]) => {
onConnectAction?.(params, nodes);
onConnect?.(params, nodes);
(params: Connection) => {
onConnectAction?.(params);
onConnect?.(params);
},
[onConnectAction, onConnect]
);