mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
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:
committed by
GitHub
parent
054fe9745f
commit
f67c0710e1
@@ -494,6 +494,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
) {
|
||||
let insertPosition = options.position;
|
||||
let lastAddedNode: INodeUi | undefined;
|
||||
const addedNodes: INodeUi[] = [];
|
||||
|
||||
const nodesWithTypeVersion = nodes.map((node) => {
|
||||
const typeVersion =
|
||||
@@ -516,7 +517,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
const nodeTypeDescription = requireNodeTypeDescription(node.type, node.typeVersion);
|
||||
|
||||
try {
|
||||
lastAddedNode = addNode(
|
||||
const newNode = addNode(
|
||||
{
|
||||
...node,
|
||||
position,
|
||||
@@ -528,6 +529,8 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
isAutoAdd,
|
||||
},
|
||||
);
|
||||
lastAddedNode = newNode;
|
||||
addedNodes.push(newNode);
|
||||
} catch (error) {
|
||||
toast.showError(error, i18n.baseText('error'));
|
||||
console.error(error);
|
||||
@@ -552,6 +555,8 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
if (!options.keepPristine) {
|
||||
uiStore.stateIsDirty = true;
|
||||
}
|
||||
|
||||
return addedNodes;
|
||||
}
|
||||
|
||||
function updatePositionForNodeWithMultipleInputs(node: INodeUi) {
|
||||
@@ -605,6 +610,10 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
historyStore.pushCommandToUndo(new AddNodeCommand(nodeData));
|
||||
}
|
||||
|
||||
if (!options.isAutoAdd) {
|
||||
createConnectionToLastInteractedWithNode(nodeData, options);
|
||||
}
|
||||
|
||||
void nextTick(() => {
|
||||
workflowsStore.setNodePristine(nodeData.name, true);
|
||||
|
||||
@@ -613,10 +622,6 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
nodeHelpers.updateNodeCredentialIssues(nodeData);
|
||||
nodeHelpers.updateNodeInputIssues(nodeData);
|
||||
|
||||
if (!options.isAutoAdd) {
|
||||
createConnectionToLastInteractedWithNode(nodeData, options);
|
||||
}
|
||||
|
||||
if (options.telemetry) {
|
||||
trackAddNode(nodeData, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user