fix: workflow restore (#3750)

This commit is contained in:
zxhlyh 2024-04-24 13:05:33 +08:00 committed by GitHub
parent ccaf335466
commit a39de8a686
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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