Skip to content

Commit 2e5caba

Browse files
committed
refactor(hooks): improve readability of useEdgeLabelSync by removing extra whitespace
1 parent 91c2340 commit 2e5caba

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lib/src/hooks/useEdgeLabelSync.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ export function useEdgeLabelSync(nodes, edges, updateEdges) {
1010
const updatedEdges = edges.map(edge => {
1111
const targetNode = nodes.find(node => node.id === edge.target);
1212
const sourceNode = nodes.find(node => node.id === edge.source);
13-
13+
1414
// Handle simple edges (non-switch nodes)
1515
if (targetNode && edge.label && edge.label.startsWith('→')) {
1616
const expectedLabel = `→ ${targetNode.data?.name || targetNode.data?.label || 'next'}`;
17-
17+
1818
if (edge.label !== expectedLabel) {
1919
hasChanges = true;
2020
return { ...edge, label: expectedLabel };
2121
}
2222
}
23-
23+
2424
// Handle condition edges from switch nodes
2525
if (sourceNode && sourceNode.type === 'switch' && edge.sourceHandle && edge.sourceHandle.startsWith('condition-')) {
2626
const conditionIndex = parseInt(edge.sourceHandle.replace('condition-', ''));
2727
const conditions = sourceNode.data?.dataConditions || sourceNode.data?.eventConditions || [];
2828
const condition = conditions[conditionIndex];
29-
29+
3030
// Determine expected label based on condition type
3131
let expectedLabel = '';
3232
if (condition) {
@@ -38,16 +38,16 @@ export function useEdgeLabelSync(nodes, edges, updateEdges) {
3838
} else {
3939
expectedLabel = `condition${conditionIndex + 1}`;
4040
}
41-
41+
4242
if (edge.label !== expectedLabel) {
4343
hasChanges = true;
4444
return { ...edge, label: expectedLabel };
4545
}
4646
}
47-
47+
4848
return edge;
4949
});
50-
50+
5151
if (hasChanges) {
5252
updateEdges(updatedEdges);
5353
}

0 commit comments

Comments
 (0)