From 0b6e576fa057248855a071e1f8a1591edef3acd4 Mon Sep 17 00:00:00 2001 From: YISH Date: Wed, 28 Feb 2024 21:30:35 +0800 Subject: [PATCH] Update index.ts --- packages/server/src/utils/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index 1af3ef3ff..c96139d7c 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -299,7 +299,7 @@ export const buildFlow = async ( exploredNode[startingNodeIds[i]] = { remainingLoop: maxLoop, lastSeenDepth: 0 } } - const initializedNode: Set = new Set() + const initializedNodes: Set = 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]