Update index.ts

This commit is contained in:
YISH
2024-03-11 20:00:43 +08:00
committed by GitHub
parent 0b6e576fa0
commit b625104433
+2 -2
View File
@@ -300,7 +300,7 @@ export const buildFlow = async (
}
const initializedNodes: Set<string> = new Set()
const nonDirectedGraph = constructGraphs(reactFlowNodes, reactFlowEdges, { isReversed: true }).graph
const reversedGraph = constructGraphs(reactFlowNodes, reactFlowEdges, { isReversed: true }).graph
while (nodeQueue.length) {
const { nodeId, depth } = nodeQueue.shift() as INodeQueue
@@ -410,7 +410,7 @@ export const buildFlow = async (
const neighNodeId = neighbourNodeIds[i]
if (ignoreNodeIds.includes(neighNodeId)) continue
if (initializedNodes.has(neighNodeId)) continue
if (nonDirectedGraph[neighNodeId].some((dependId) => !initializedNodes.has(dependId))) continue
if (reversedGraph[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]