From 1c0068e95b89fd04a8fe62a2952b680858107e05 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Mon, 29 Sep 2025 13:34:05 +0800 Subject: [PATCH] fix can't stop webhook debug --- .../workflow-app/hooks/use-workflow-run.ts | 28 ++++++++++++++++--- .../components/workflow/header/run-mode.tsx | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/web/app/components/workflow-app/hooks/use-workflow-run.ts b/web/app/components/workflow-app/hooks/use-workflow-run.ts index a5bb173c1e..9252718a53 100644 --- a/web/app/components/workflow-app/hooks/use-workflow-run.ts +++ b/web/app/components/workflow-app/hooks/use-workflow-run.ts @@ -221,6 +221,9 @@ export const useWorkflowRun = () => { setWorkflowRunningData({ result: { status: WorkflowRunningStatus.Waiting, + inputs_truncated: false, + process_data_truncated: false, + outputs_truncated: false, }, tracing: [], resultText: 'Waiting for webhook call...', @@ -230,6 +233,9 @@ export const useWorkflowRun = () => { setWorkflowRunningData({ result: { status: WorkflowRunningStatus.Running, + inputs_truncated: false, + process_data_truncated: false, + outputs_truncated: false, }, tracing: [], resultText: '', @@ -402,10 +408,13 @@ export const useWorkflowRun = () => { ? url : `${API_PREFIX}${url.startsWith('/') ? url : `/${url}`}` - const poll = async (): Promise => { - const controller = new AbortController() - abortControllerRef.current = controller + const controller = new AbortController() + abortControllerRef.current = controller + // Store controller in global variable as fallback + ;(window as any).__webhookDebugAbortController = controller + + const poll = async (): Promise => { try { const baseOptions = getBaseOptions() const headers = new Headers(baseOptions.headers as Headers) @@ -542,12 +551,23 @@ export const useWorkflowRun = () => { return } - abortControllerRef.current?.abort() + // Try webhook debug controller from global variable first + const webhookController = (window as any).__webhookDebugAbortController + if (webhookController) + webhookController.abort() + + // Also try the ref + if (abortControllerRef.current) + abortControllerRef.current.abort() + abortControllerRef.current = null const { setWorkflowRunningData } = workflowStore.getState() setWorkflowRunningData({ result: { status: WorkflowRunningStatus.Stopped, + inputs_truncated: false, + process_data_truncated: false, + outputs_truncated: false, }, tracing: [], resultText: '', diff --git a/web/app/components/workflow/header/run-mode.tsx b/web/app/components/workflow/header/run-mode.tsx index 5f6dbd820c..067be78dcf 100644 --- a/web/app/components/workflow/header/run-mode.tsx +++ b/web/app/components/workflow/header/run-mode.tsx @@ -64,7 +64,7 @@ const RunMode = ({ } else if (option.type === 'webhook') { if (option.nodeId) - handleWorkflowTriggerWebhookRunInWorkflow({ nodeId: option.nodeId, debugUrl: option.debugUrl }) + handleWorkflowTriggerWebhookRunInWorkflow({ nodeId: option.nodeId }) } else { // Placeholder for trigger-specific execution logic for schedule, webhook, plugin types