This commit is contained in:
StyleZhang 2024-03-13 17:06:16 +08:00
parent e11fc8c131
commit 1c5d07871f
1 changed files with 9 additions and 7 deletions

View File

@ -93,13 +93,15 @@ export const useWorkflow = () => {
return list
const traverse = (root: Node, callback: (node: Node) => void) => {
const incomers = getIncomers(root, nodes, edges)
if (root) {
const incomers = getIncomers(root, nodes, edges)
if (incomers.length) {
incomers.forEach((node) => {
callback(node)
traverse(node, callback)
})
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)
})