Commit 1c5d0787 authored by StyleZhang's avatar StyleZhang

hooks

parent e11fc8c1
......@@ -93,13 +93,15 @@ export const useWorkflow = () => {
return list
const traverse = (root: Node, callback: (node: Node) => void) => {
const incomers = getIncomers(root, nodes, edges)
if (incomers.length) {
incomers.forEach((node) => {
callback(node)
traverse(node, callback)
})
if (root) {
const incomers = getIncomers(root, nodes, edges)
if (incomers.length) {
incomers.forEach((node) => {
callback(node)
traverse(node, callback)
})
}
}
}
traverse(currentNode, (node) => {
......@@ -107,7 +109,7 @@ export const useWorkflow = () => {
})
const length = list.length
if (length && list.some(item => item.data.type === BlockEnum.Start)) {
if (length) {
return list.reverse().filter((item) => {
return SUPPORT_OUTPUT_VARS_NODE.includes(item.data.type)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment