mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
fix(editor): Ignore unconnected nodes when executing workflow (#14683)
This commit is contained in:
@@ -259,14 +259,28 @@ describe('useWorkflowsStore', () => {
|
||||
});
|
||||
|
||||
describe('nodesIssuesExist', () => {
|
||||
it('should return true when a node has issues', () => {
|
||||
it('should return true when a node has issues and connected', () => {
|
||||
workflowsStore.workflow.nodes = [
|
||||
{ name: 'Node1', issues: { error: ['Error message'] } },
|
||||
{ name: 'Node2' },
|
||||
] as unknown as IWorkflowDb['nodes'];
|
||||
|
||||
workflowsStore.workflow.connections = {
|
||||
Node1: { main: [[{ node: 'Node2' } as IConnection]] },
|
||||
};
|
||||
|
||||
const hasIssues = workflowsStore.nodesIssuesExist;
|
||||
expect(hasIssues).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when node has issues but it is not connected', () => {
|
||||
workflowsStore.workflow.nodes = [
|
||||
{ name: 'Node1', issues: { error: ['Error message'] } },
|
||||
{ name: 'Node2' },
|
||||
] as unknown as IWorkflowDb['nodes'];
|
||||
|
||||
const hasIssues = workflowsStore.nodesIssuesExist;
|
||||
expect(hasIssues).toBe(true);
|
||||
expect(hasIssues).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false when no nodes have issues', () => {
|
||||
@@ -275,6 +289,10 @@ describe('useWorkflowsStore', () => {
|
||||
{ name: 'Node2' },
|
||||
] as unknown as IWorkflowDb['nodes'];
|
||||
|
||||
workflowsStore.workflow.connections = {
|
||||
Node1: { main: [[{ node: 'Node2' } as IConnection]] },
|
||||
};
|
||||
|
||||
const hasIssues = workflowsStore.nodesIssuesExist;
|
||||
expect(hasIssues).toBe(false);
|
||||
});
|
||||
|
||||
@@ -256,19 +256,15 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
}, {});
|
||||
});
|
||||
|
||||
const nodesIssuesExist = computed(() => {
|
||||
for (const node of workflow.value.nodes) {
|
||||
const isNodeDisabled = node.disabled === true;
|
||||
const noNodeIssues = node.issues === undefined || Object.keys(node.issues).length === 0;
|
||||
if (isNodeDisabled || noNodeIssues) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
const nodesIssuesExist = computed(() =>
|
||||
workflow.value.nodes.some((node) => {
|
||||
const nodeHasIssues = !!Object.keys(node.issues ?? {}).length;
|
||||
const isConnected =
|
||||
Object.keys(outgoingConnectionsByNodeName(node.name)).length > 0 ||
|
||||
Object.keys(incomingConnectionsByNodeName(node.name)).length > 0;
|
||||
return !node.disabled && isConnected && nodeHasIssues;
|
||||
}),
|
||||
);
|
||||
|
||||
const pinnedWorkflowData = computed(() => workflow.value.pinData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user