Skip to content

Commit c423b4d

Browse files
committed
fix: allow running a workflow that has unconnected node issues for the current trigger
1 parent 6786915 commit c423b4d

File tree

5 files changed

+500
-9
lines changed

5 files changed

+500
-9
lines changed

packages/frontend/editor-ui/src/app/composables/useRunWorkflow.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,15 @@ describe('useRunWorkflow({ router })', () => {
209209
expect(workflowsStore.executionWaitingForWebhook).toBe(false);
210210
});
211211

212-
it('should prevent running a webhook-based workflow that has issues', async () => {
212+
it('should not prevent running a webhook-based workflow that has issues', async () => {
213213
const { runWorkflowApi } = useRunWorkflow({ router });
214214
vi.mocked(workflowsStore).nodesIssuesExist = true;
215215
vi.mocked(workflowsStore).runWorkflow.mockResolvedValue({
216216
executionId: '123',
217217
waitingForWebhook: true,
218218
});
219219

220-
await expect(runWorkflowApi({} as IStartRunData)).rejects.toThrow(
221-
'workflowRun.showError.resolveOutstandingIssues',
222-
);
220+
expect(async () => await runWorkflowApi({} as IStartRunData)).not.toThrow();
223221

224222
vi.mocked(workflowsStore).nodesIssuesExist = false;
225223
});

packages/frontend/editor-ui/src/app/composables/useRunWorkflow.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ export function useRunWorkflow(useRunWorkflowOpts: {
116116
workflowState.setActiveExecutionId(response.executionId);
117117
}
118118

119-
if (response.waitingForWebhook === true && workflowsStore.nodesIssuesExist) {
120-
workflowState.setActiveExecutionId(undefined);
121-
throw new Error(i18n.baseText('workflowRun.showError.resolveOutstandingIssues'));
122-
}
123-
124119
if (response.waitingForWebhook === true) {
125120
workflowsStore.executionWaitingForWebhook = true;
126121
}
@@ -377,6 +372,12 @@ export function useRunWorkflow(useRunWorkflowOpts: {
377372
workflowState.setWorkflowExecutionData(executionData);
378373
nodeHelpers.updateNodesExecutionIssues();
379374

375+
const triggerNodeName = triggerToStartFrom?.name ?? '';
376+
const triggerNode = workflowsStore.getNodeByName(triggerNodeName);
377+
if (triggerNode && workflowsStore.nodeHasIssuesDownstream(triggerNode.name)) {
378+
throw new Error(i18n.baseText('workflowRun.showError.resolveOutstandingIssues'));
379+
}
380+
380381
useDocumentTitle().setDocumentTitle(workflowObject.value.name as string, 'EXECUTING');
381382
const runWorkflowApiResponse = await runWorkflowApi(startRunData);
382383
const pinData = workflowData.pinData ?? {};

0 commit comments

Comments
 (0)