Update index.ts

This commit is contained in:
YISH 2024-02-28 21:30:35 +08:00 committed by GitHub
parent ceebd3e11a
commit 0b6e576fa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -299,7 +299,7 @@ export const buildFlow = async (
exploredNode[startingNodeIds[i]] = { remainingLoop: maxLoop, lastSeenDepth: 0 }
}
const initializedNode: Set<string> = new Set()
const initializedNodes: Set<string> = new Set()
const nonDirectedGraph = constructGraphs(reactFlowNodes, reactFlowEdges, { isReversed: true }).graph
while (nodeQueue.length) {
const { nodeId, depth } = nodeQueue.shift() as INodeQueue
@ -386,7 +386,7 @@ export const buildFlow = async (
flowNodes[nodeIndex].data.instance = outputResult
logger.debug(`[server]: Finished initializing ${reactFlowNode.data.label} (${reactFlowNode.data.id})`)
initializedNode.add(reactFlowNode.data.id)
initializedNodes.add(reactFlowNode.data.id)
}
} catch (e: any) {
logger.error(e)
@ -409,8 +409,8 @@ export const buildFlow = async (
for (let i = 0; i < neighbourNodeIds.length; i += 1) {
const neighNodeId = neighbourNodeIds[i]
if (ignoreNodeIds.includes(neighNodeId)) continue
if (initializedNode.has(neighNodeId)) continue
if (nonDirectedGraph[neighNodeId].some((dependId) => !initializedNode.has(dependId))) continue
if (initializedNodes.has(neighNodeId)) continue
if (nonDirectedGraph[neighNodeId].some((dependId) => !initializedNodes.has(dependId))) continue
// If nodeId has been seen, cycle detected
if (Object.prototype.hasOwnProperty.call(exploredNode, neighNodeId)) {
const { remainingLoop, lastSeenDepth } = exploredNode[neighNodeId]