diff --git a/packages/editor-ui/src/components/Node.vue b/packages/editor-ui/src/components/Node.vue index e1ff7b8c52f3b..de16549f0d238 100644 --- a/packages/editor-ui/src/components/Node.vue +++ b/packages/editor-ui/src/components/Node.vue @@ -286,15 +286,11 @@ export default defineComponent({ return this.data.type === MANUAL_TRIGGER_NODE_TYPE; }, isConfigNode(): boolean { - return this.nodeTypesStore.isConfigNode( - this.getCurrentWorkflow(), - this.data, - this.data?.type ?? '', - ); + return this.nodeTypesStore.isConfigNode(this.workflow, this.data, this.data?.type ?? ''); }, isConfigurableNode(): boolean { return this.nodeTypesStore.isConfigurableNode( - this.getCurrentWorkflow(), + this.workflow, this.data, this.data?.type ?? '', ); @@ -349,9 +345,8 @@ export default defineComponent({ }; if (this.node && this.nodeType) { - const workflow = this.workflowsStore.getCurrentWorkflow(); const inputs = - NodeHelpers.getNodeInputs(workflow, this.node, this.nodeType) || + NodeHelpers.getNodeInputs(this.workflow, this.node, this.nodeType) || ([] as Array); const inputTypes = NodeHelpers.getConnectionTypes(inputs); @@ -372,7 +367,7 @@ export default defineComponent({ } const outputs = - NodeHelpers.getNodeOutputs(workflow, this.node, this.nodeType) || + NodeHelpers.getNodeOutputs(this.workflow, this.node, this.nodeType) || ([] as Array); const outputTypes = NodeHelpers.getConnectionTypes(outputs); @@ -634,8 +629,7 @@ export default defineComponent({ // and ends up bogging down the UI with big workflows, for example when pasting a workflow or even opening a node... // so we only update it when necessary (when node is mounted and when it's opened and closed (isActive)) try { - const nodeSubtitle = - this.getNodeSubtitle(this.data, this.nodeType, this.getCurrentWorkflow()) || ''; + const nodeSubtitle = this.getNodeSubtitle(this.data, this.nodeType, this.workflow) || ''; this.nodeSubtitle = nodeSubtitle.includes(CUSTOM_API_CALL_KEY) ? '' : nodeSubtitle; } catch (e) { diff --git a/packages/editor-ui/src/mixins/nodeBase.ts b/packages/editor-ui/src/mixins/nodeBase.ts index 97a82ae31bb06..470a2ca167795 100644 --- a/packages/editor-ui/src/mixins/nodeBase.ts +++ b/packages/editor-ui/src/mixins/nodeBase.ts @@ -17,6 +17,7 @@ import type { INodeInputConfiguration, INodeTypeDescription, INodeOutputConfiguration, + Workflow, } from 'n8n-workflow'; import { useUIStore } from '@/stores/ui.store'; import { useWorkflowsStore } from '@/stores/workflows.store'; @@ -104,6 +105,10 @@ export const nodeBase = defineComponent({ showCustomTooltip: { type: Boolean, }, + workflow: { + type: Object as () => Workflow, + required: true, + }, }, methods: { __addEndpointTestingData(endpoint: Endpoint, type: string, inputIndex: number) { @@ -123,9 +128,8 @@ export const nodeBase = defineComponent({ [key: string]: number; } = {}; - const workflow = this.workflowsStore.getCurrentWorkflow(); const inputs: Array = - NodeHelpers.getNodeInputs(workflow, this.data!, nodeTypeData) || []; + NodeHelpers.getNodeInputs(this.workflow, this.data!, nodeTypeData) || []; this.inputs = inputs; const sortedInputs = [...inputs]; @@ -338,8 +342,7 @@ export const nodeBase = defineComponent({ [key: string]: number; } = {}; - const workflow = this.workflowsStore.getCurrentWorkflow(); - this.outputs = NodeHelpers.getNodeOutputs(workflow, this.data, nodeTypeData) || []; + this.outputs = NodeHelpers.getNodeOutputs(this.workflow, this.data, nodeTypeData) || []; // TODO: There are still a lot of references of "main" in NodesView and // other locations. So assume there will be more problems diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 06e4186cc0ec9..3ef14e9ce25f4 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -58,6 +58,7 @@ :isActive="!!activeNode && activeNode.name === nodeData.name" :hideActions="pullConnActive" :isProductionExecutionPreview="isProductionExecutionPreview" + :workflow="currentWorkflowObject" >