From a39de8a6868517acf099fb412838e56943735f5d Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 24 Apr 2024 13:05:33 +0800 Subject: [PATCH] fix: workflow restore (#3750) --- web/app/components/workflow/hooks/use-workflow.ts | 7 +++---- web/app/components/workflow/panel/index.tsx | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.ts index c118fff96..ee3b6f1c9 100644 --- a/web/app/components/workflow/hooks/use-workflow.ts +++ b/web/app/components/workflow/hooks/use-workflow.ts @@ -19,7 +19,6 @@ import type { Viewport, } from 'reactflow' import { - changeNodesAndEdgesId, getLayoutByDagre, initialEdges, initialNodes, @@ -321,13 +320,13 @@ export const useWorkflow = () => { const renderTreeFromRecord = useCallback((nodes: Node[], edges: Edge[], viewport?: Viewport) => { const { setViewport } = reactflow - const [newNodes, newEdges] = changeNodesAndEdgesId(nodes, edges) + const nodesMap = nodes.map(node => ({ ...node, data: { ...node.data, selected: false } })) eventEmitter?.emit({ type: WORKFLOW_DATA_UPDATE, payload: { - nodes: initialNodes(newNodes, newEdges), - edges: initialEdges(newEdges, newNodes), + nodes: initialNodes(nodesMap, edges), + edges: initialEdges(edges, nodesMap), }, } as any) diff --git a/web/app/components/workflow/panel/index.tsx b/web/app/components/workflow/panel/index.tsx index fd2228532..386f62702 100644 --- a/web/app/components/workflow/panel/index.tsx +++ b/web/app/components/workflow/panel/index.tsx @@ -23,6 +23,7 @@ const Panel: FC = () => { const showInputsPanel = useStore(s => s.showInputsPanel) const workflowRunningData = useStore(s => s.workflowRunningData) const historyWorkflowData = useStore(s => s.historyWorkflowData) + const isRestoring = useStore(s => s.isRestoring) const { currentLogItem, setCurrentLogItem, showMessageLogModal, setShowMessageLogModal } = useAppStore(useShallow(state => ({ currentLogItem: state.currentLogItem, setCurrentLogItem: state.setCurrentLogItem, @@ -48,7 +49,7 @@ const Panel: FC = () => { ]) return ( -
+
{ showMessageLogModal && (