refactor(useNodeConnections): change param names

This commit is contained in:
moklick
2025-01-09 16:08:52 +01:00
parent 7dac54ff44
commit 78f9d4e645
8 changed files with 28 additions and 26 deletions

View File

@@ -12,7 +12,7 @@ function CustomHandle({ nodeId, ...handleProps }: HandleProps & { nodeId: string
[nodeId]
);
const connections = useNodeConnections({
type: handleProps.type,
handleType: handleProps.type,
handleId: handleProps.id,
onConnect,
onDisconnect,

View File

@@ -15,7 +15,7 @@ function CustomHandle({ nodeId, ...handleProps }: HandleProps & { nodeId: string
[nodeId]
);
const connections = useNodeConnections({
type: handleProps.type,
handleType: handleProps.type,
handleId: handleProps.id,
onConnect,
onDisconnect,

View File

@@ -4,7 +4,7 @@ import { isTextNode, type MyNode } from '.';
function ResultNode() {
const connections = useNodeConnections({
type: 'target',
handleType: 'target',
});
const nodesData = useNodesData<MyNode>(connections.map((connection) => connection.source));
const textNodes = nodesData.filter(isTextNode);

View File

@@ -5,7 +5,7 @@ import { isTextNode, type TextNode, type MyNode } from '.';
function UppercaseNode({ id }: NodeProps) {
const { updateNodeData } = useReactFlow();
const connections = useNodeConnections({
type: 'target',
handleType: 'target',
});
const nodesData = useNodesData<MyNode>(connections[0]?.source);
const textNode = isTextNode(nodesData) ? nodesData : null;

View File

@@ -14,8 +14,8 @@
$$restProps;
const connections = useNodeConnections({
nodeId: id,
type: 'target'
id: id,
handleType: 'target'
});
$: nodeData = useNodesData<MyNode>($connections.map((connection) => connection.source));

View File

@@ -17,8 +17,8 @@
const { updateNodeData } = useSvelteFlow();
const connections = useNodeConnections({
nodeId: id,
type: 'target'
id: id,
handleType: 'target'
});
$: nodeData = useNodesData<MyNode>($connections[0]?.source);