fix(editor): Fix Adding nodes one after the other also adds connections (no-changelog) (#11312)

Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
Raúl Gómez Morales
2024-10-21 13:54:49 +02:00
committed by GitHub
parent 054fe9745f
commit f67c0710e1
4 changed files with 42 additions and 10 deletions

View File

@@ -859,8 +859,12 @@ async function onAddNodesAndConnections(
return;
}
await addNodes(nodes, { dragAndDrop, position, trackHistory: true, telemetry: true });
await nextTick();
const addedNodes = await addNodes(nodes, {
dragAndDrop,
position,
trackHistory: true,
telemetry: true,
});
const offsetIndex = editableWorkflow.value.nodes.length - nodes.length;
const mappedConnections: CanvasConnectionCreateData[] = connections.map(({ from, to }) => {
@@ -886,9 +890,8 @@ async function onAddNodesAndConnections(
addConnections(mappedConnections);
void nextTick(() => {
uiStore.resetLastInteractedWith();
});
uiStore.resetLastInteractedWith();
selectNodes([addedNodes[addedNodes.length - 1].id]);
}
async function onRevertAddNode({ node }: { node: INodeUi }) {
@@ -1565,6 +1568,7 @@ onBeforeUnmount(() => {
<template>
<WorkflowCanvas
v-if="editableWorkflow && editableWorkflowObject && !isLoading"
:id="editableWorkflow.id"
:workflow="editableWorkflow"
:workflow-object="editableWorkflowObject"
:fallback-nodes="fallbackNodes"