implemented more broader tracking of handleConnections

This commit is contained in:
peterkogo
2024-10-10 17:20:21 +02:00
parent eb71e34d44
commit 0ae06ce5cb
3 changed files with 34 additions and 16 deletions
@@ -12,7 +12,7 @@ import { useNodeId } from '../contexts/NodeIdContext';
type useHandleConnectionsParams = {
type: HandleType;
id?: string | null;
id?: string;
nodeId?: string;
onConnect?: (connections: Connection[]) => void;
onDisconnect?: (connections: Connection[]) => void;
@@ -31,7 +31,7 @@ type useHandleConnectionsParams = {
*/
export function useHandleConnections({
type,
id = null,
id,
nodeId,
onConnect,
onDisconnect,
@@ -42,7 +42,7 @@ export function useHandleConnections({
const prevConnections = useRef<Map<string, HandleConnection> | null>(null);
const connections = useStore(
(state) => state.connectionLookup.get(`${currentNodeId}-${type}-${id}`),
(state) => state.connectionLookup.get(`${currentNodeId}${type ? (id ? `-${type}-${id}` : `-${type}`) : ''}`),
areConnectionMapsEqual
);