fix(editor): Fix an issue where some node actions wouldn't select default params correctly (#4946)

This commit is contained in:
OlegIvaniv 2022-12-16 10:58:06 +01:00 committed by GitHub
parent 6b83972f6e
commit 626879b3a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,10 +33,12 @@ import {
INodeCredentialsDetails,
INodeExecutionData,
INodeIssueData,
INodeParameters,
IPinData,
IRunData,
ITaskData,
IWorkflowSettings,
NodeHelpers,
} from 'n8n-workflow';
import Vue from 'vue';
@ -824,8 +826,18 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
const latestNode = this.workflow.nodes.findLast(
(node) => node.type === updateInformation.key,
) as INodeUi;
const nodeType = useNodeTypesStore().getNodeType(latestNode.type);
if(!nodeType) return;
if (latestNode) this.setNodeParameters({ ...updateInformation, name: latestNode.name }, true);
const nodeParams = NodeHelpers.getNodeParameters(
nodeType.properties,
updateInformation.value as INodeParameters,
true,
false,
latestNode,
);
if (latestNode) this.setNodeParameters({ value: nodeParams, name: latestNode.name }, true);
},
addNodeExecutionData(pushData: IPushDataNodeExecuteAfter): void {