Skip to content

Commit e635109

Browse files
committed
Fix duplicate edge creation in Create & Connect Node functionality
Remove redundant createEdge call that was creating duplicate connections when using "Create & Connect Node" feature. Connection is already established through the dependencies field in workItemInput.
1 parent dfc3183 commit e635109

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

packages/web/src/components/CreateNodeModal.tsx

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -297,32 +297,13 @@ export function CreateNodeModal({ isOpen, onClose, parentNodeId, position }: Cre
297297
if (result.data?.createWorkItems?.workItems?.[0]) {
298298
const createdNode = result.data.createWorkItems.workItems[0];
299299

300-
// If parentNodeId exists, also create an Edge entity for the connection
300+
// Connection is already created through the dependencies field in workItemInput
301301
if (parentNodeId) {
302-
try {
303-
await createEdge({
304-
variables: {
305-
input: [{
306-
type: selectedRelationType,
307-
weight: 0.8,
308-
source: { connect: { where: { node: { id: createdNode.id } } } },
309-
target: { connect: { where: { node: { id: parentNodeId } } } }
310-
}]
311-
}
312-
});
313-
314-
const relationshipLabel = getRelationshipConfig(selectedRelationType as RelationshipType).label;
315-
showSuccess(
316-
'Node Created and Connected Successfully!',
317-
`"${createdNode.title}" has been created with a "${relationshipLabel}" relationship.`
318-
);
319-
} catch (edgeError) {
320-
console.error('Failed to create edge:', edgeError);
321-
showSuccess(
322-
'Node Created Successfully!',
323-
`"${createdNode.title}" has been created but the connection failed. You can connect it manually.`
324-
);
325-
}
302+
const relationshipLabel = getRelationshipConfig(selectedRelationType as RelationshipType).label;
303+
showSuccess(
304+
'Node Created and Connected Successfully!',
305+
`"${createdNode.title}" has been created with a "${relationshipLabel}" relationship.`
306+
);
326307
} else {
327308
showSuccess(
328309
'Node Created Successfully!',

0 commit comments

Comments
 (0)