fix: run error

This commit is contained in:
StyleZhang
2024-04-02 21:05:04 +08:00
parent cf449b31a1
commit f7e4f0a988
2 changed files with 18 additions and 1 deletions

View File

@ -126,6 +126,7 @@ export const useWorkflowRun = () => {
onWorkflowFinished,
onNodeStarted,
onNodeFinished,
onError,
...restCallback
} = callback || {}
workflowStore.setState({ historyWorkflowData: undefined })
@ -211,6 +212,22 @@ export const useWorkflowRun = () => {
if (onWorkflowFinished)
onWorkflowFinished(params)
},
onError: (params) => {
const {
workflowRunningData,
setWorkflowRunningData,
} = workflowStore.getState()
setWorkflowRunningData(produce(workflowRunningData!, (draft) => {
draft.result = {
...draft.result,
status: WorkflowRunningStatus.Failed,
}
}))
if (onError)
onError(params)
},
onNodeStarted: (params) => {
const { data } = params
const {