Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: workflow restore (#3750)

zxhlyha39de8a68685
diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.ts
index c118fff968e..ee3b6f1c966 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 fd222853282..386f627021d 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 (
- <div className='absolute top-14 right-0 bottom-2 flex z-10'>
+ <div className='absolute top-14 right-0 bottom-2 flex z-10' key={`${isRestoring}`}>
{
showMessageLogModal && (
<MessageLogModal