remove redundant connectionLookup entries
This commit is contained in:
@@ -32,7 +32,7 @@ type useHandleConnectionsParams = {
|
||||
*/
|
||||
export function useHandleConnections({
|
||||
type,
|
||||
id = null,
|
||||
id,
|
||||
nodeId,
|
||||
onConnect,
|
||||
onDisconnect,
|
||||
@@ -47,7 +47,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 ? `-${id}` : ''}`),
|
||||
areConnectionMapsEqual
|
||||
);
|
||||
|
||||
|
||||
@@ -239,7 +239,14 @@ export function useReactFlow<NodeType extends Node = Node, EdgeType extends Edge
|
||||
Array.from(
|
||||
store
|
||||
.getState()
|
||||
.connectionLookup.get(`${nodeId}-${type}-${id ?? null}`)
|
||||
.connectionLookup.get(`${nodeId}-${type}${id ? `-${id}` : ''}`)
|
||||
?.values() ?? []
|
||||
),
|
||||
getNodeConnections: ({ type, handleId, nodeId }) =>
|
||||
Array.from(
|
||||
store
|
||||
.getState()
|
||||
.connectionLookup.get(`${nodeId}${type ? (handleId ? `-${type}-${handleId}` : `-${type}`) : ''}`)
|
||||
?.values() ?? []
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user