feat: Update Workflow class usage on the Frontend for better performance (no-changelog) (#17680)

This commit is contained in:
Alex Grozav
2025-08-04 15:04:00 +03:00
committed by GitHub
parent ff8531d544
commit 279dce639a
66 changed files with 659 additions and 660 deletions

View File

@@ -11,6 +11,7 @@ import type {
NodeConnectionType,
INodeInputConfiguration,
INodeTypeDescription,
Workflow,
} from 'n8n-workflow';
import { useDebounce } from '@/composables/useDebounce';
import { OnClickOutside } from '@vueuse/components';
@@ -59,10 +60,11 @@ const nodeType = computed(() =>
const nodeData = computed(() => workflowsStore.getNodeByName(props.rootNode.name));
const ndvStore = useNDVStore();
const workflow = computed(() => workflowsStore.getCurrentWorkflow());
const workflowObject = computed(() => workflowsStore.workflowObject as Workflow);
const nodeInputIssues = computed(() => {
const issues = nodeHelpers.getNodeIssues(nodeType.value, props.rootNode, workflow.value, [
const issues = nodeHelpers.getNodeIssues(nodeType.value, props.rootNode, workflowObject.value, [
'typeUnknown',
'parameters',
'credentials',
@@ -82,7 +84,8 @@ const connectedNodes = computed<Record<string, NodeConfig[]>>(() => {
// Get input-index-specific connections using the per-type index
const nodeConnections =
workflow.value.connectionsByDestinationNode[props.rootNode.name]?.[connection.type] ?? [];
workflowObject.value.connectionsByDestinationNode[props.rootNode.name]?.[connection.type] ??
[];
const inputConnections = nodeConnections[typeIndex] ?? [];
const nodeNames = inputConnections.map((conn) => conn.node);
const nodes = getINodesFromNames(nodeNames);
@@ -159,7 +162,7 @@ function getINodesFromNames(names: string[]): NodeConfig[] {
if (node) {
const matchedNodeType = nodeTypesStore.getNodeType(node.type);
if (matchedNodeType) {
const issues = nodeHelpers.getNodeIssues(matchedNodeType, node, workflow.value);
const issues = nodeHelpers.getNodeIssues(matchedNodeType, node, workflowObject.value);
const stringifiedIssues = issues ? nodeHelpers.nodeIssuesToString(issues, node) : '';
return { node, nodeType: matchedNodeType, issues: stringifiedIssues };
}
@@ -187,7 +190,7 @@ function isNodeInputConfiguration(
function getPossibleSubInputConnections(): INodeInputConfiguration[] {
if (!nodeType.value || !props.rootNode) return [];
const inputs = NodeHelpers.getNodeInputs(workflow.value, props.rootNode, nodeType.value);
const inputs = NodeHelpers.getNodeInputs(workflowObject.value, props.rootNode, nodeType.value);
const nonMainInputs = inputs.filter((input): input is INodeInputConfiguration => {
if (!isNodeInputConfiguration(input)) return false;