From 2d6b30f3b86b4ba857e847a9d09cd8c5ab50d5f0 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 9 Feb 2026 14:36:57 +0800 Subject: [PATCH 1/2] fix: stop but tracing is still loaing and not show current tracing res --- .../workflow-app/hooks/use-workflow-run.ts | 32 +++++++++++++------ .../workflow/panel/workflow-preview.tsx | 6 +++- 2 files changed, 27 insertions(+), 11 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 88249dc7f5..9af0ebe9a3 100644 --- a/web/app/components/workflow-app/hooks/use-workflow-run.ts +++ b/web/app/components/workflow-app/hooks/use-workflow-run.ts @@ -675,6 +675,7 @@ export const useWorkflowRun = () => { const handleStopRun = useCallback((taskId: string) => { const setStoppedState = () => { const { + workflowRunningData, setWorkflowRunningData, setIsListening, setShowVariableInspectPanel, @@ -682,16 +683,27 @@ export const useWorkflowRun = () => { setListeningTriggerNodeId, } = workflowStore.getState() - setWorkflowRunningData({ - result: { - status: WorkflowRunningStatus.Stopped, - inputs_truncated: false, - process_data_truncated: false, - outputs_truncated: false, - }, - tracing: [], - resultText: '', - }) + if (workflowRunningData) { + setWorkflowRunningData({ + ...workflowRunningData, + result: { + ...workflowRunningData.result, + status: WorkflowRunningStatus.Stopped, + }, + }) + } + else { + setWorkflowRunningData({ + result: { + status: WorkflowRunningStatus.Stopped, + inputs_truncated: false, + process_data_truncated: false, + outputs_truncated: false, + }, + tracing: [], + resultText: '', + }) + } setIsListening(false) setListeningTriggerType(null) setListeningTriggerNodeId(null) diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsx index cf739d738e..d631f96caa 100644 --- a/web/app/components/workflow/panel/workflow-preview.tsx +++ b/web/app/components/workflow/panel/workflow-preview.tsx @@ -63,6 +63,10 @@ const WorkflowPreview = () => { return 'TRACING' })() + const shouldShowTracingLoading = effectiveTab === 'TRACING' + && !workflowRunningData?.tracing?.length + && (workflowRunningData?.result?.status === WorkflowRunningStatus.Running || !workflowRunningData?.result) + const handleTabChange = (tab: string) => { setUserSelectedTab(tab) } @@ -258,7 +262,7 @@ const WorkflowPreview = () => { /> ) : null} - {effectiveTab === 'TRACING' && !workflowRunningData?.tracing?.length + {shouldShowTracingLoading ? (
From b289e6a2b6bb617d3a61e3a0544ed41dcb26da16 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 9 Feb 2026 15:19:52 +0800 Subject: [PATCH 2/2] fix: basic app crash by llm editor use the workflow context --- .../components/base/prompt-editor/index.tsx | 69 +++++++++++++++++-- 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/web/app/components/base/prompt-editor/index.tsx b/web/app/components/base/prompt-editor/index.tsx index e4a97c163f..ded737f3f4 100644 --- a/web/app/components/base/prompt-editor/index.tsx +++ b/web/app/components/base/prompt-editor/index.tsx @@ -16,6 +16,7 @@ import type { VariableBlockType, WorkflowVariableBlockType, } from './types' +import type { Node as WorkflowNode } from '@/app/components/workflow/types' import type { EventPayload } from '@/context/event-emitter' import { CodeNode } from '@lexical/code' import { LexicalComposer } from '@lexical/react/LexicalComposer' @@ -34,6 +35,8 @@ import { import * as React from 'react' import { useEffect } from 'react' import { Trans } from 'react-i18next' +import { WorkflowContext } from '@/app/components/workflow/context' +import { HooksStoreContext } from '@/app/components/workflow/hooks-store/provider' import { FileReferenceNode } from '@/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/node' import { FilePreviewContextProvider } from '@/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/preview-context' import FileReferenceReplacementBlock from '@/app/components/workflow/skill/editor/skill-editor/plugins/file-reference-block/replacement-block' @@ -153,6 +156,30 @@ const EnterCommandPlugin: FC<{ onEnter?: (event: KeyboardEvent) => void }> = ({ return null } +type WorkflowAvailableNodesProps = { + nodeId?: string + isSupportSandbox?: boolean + children: (availableNodes: WorkflowNode[]) => React.ReactNode +} + +const WorkflowAvailableNodes: FC = ({ + nodeId, + isSupportSandbox, + children, +}) => { + const { getBeforeNodesInSameBranch } = useWorkflow() + const availableNodes = React.useMemo( + () => nodeId && isSupportSandbox ? getBeforeNodesInSameBranch(nodeId || '') : [], + [getBeforeNodesInSameBranch, isSupportSandbox, nodeId], + ) + + return ( + <> + {children(availableNodes)} + + ) +} + export type PromptEditorProps = { instanceId?: string nodeId?: string @@ -185,7 +212,11 @@ export type PromptEditorProps = { onEnter?: (event: KeyboardEvent) => void } -const PromptEditor: FC = ({ +type PromptEditorContentProps = PromptEditorProps & { + availableNodes: WorkflowNode[] +} + +const PromptEditorContent: FC = ({ instanceId, nodeId, compact, @@ -215,6 +246,7 @@ const PromptEditor: FC = ({ isSupportSandbox, disableToolBlocks, onEnter, + availableNodes, }) => { const { eventEmitter } = useEventEmitterContextContext() const initialConfig = { @@ -264,12 +296,6 @@ const PromptEditor: FC = ({ } as EventPayload) }, [eventEmitter, historyBlock?.history]) - const { getBeforeNodesInSameBranch } = useWorkflow() - const availableNodes = React.useMemo( - () => nodeId && isSupportSandbox ? getBeforeNodesInSameBranch(nodeId || '') : [], - [getBeforeNodesInSameBranch, isSupportSandbox, nodeId], - ) - const toolBlockContextValue = React.useMemo(() => { if (!onToolMetadataChange) return null @@ -491,4 +517,33 @@ const PromptEditor: FC = ({ ) } +const PromptEditor: FC = (props) => { + const workflowStore = React.useContext(WorkflowContext) + const hooksStore = React.useContext(HooksStoreContext) + const hasWorkflowContext = Boolean(workflowStore && hooksStore) + + if (!hasWorkflowContext) { + return ( + + ) + } + + return ( + + {availableNodes => ( + + )} + + ) +} + export default PromptEditor