Skip to content

Commit 58df7ef

Browse files
committed
Fix lint error
1 parent 1add4ca commit 58df7ef

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/agentflow/src/infrastructure/store/AgentflowContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ export function AgentflowStateProvider({ children, initialFlow }: AgentflowState
6868
// Helper function to generate unique copy IDs
6969
const getUniqueCopyId = useCallback((baseId: string, nodes: FlowNode[]): string => {
7070
const existingIds = new Set(nodes.map((node) => node.id))
71-
let i = 1
72-
while (true) {
71+
for (let i = 1; i < Number.MAX_SAFE_INTEGER; i++) {
7372
const newId = `${baseId}_copy_${i}`
7473
if (!existingIds.has(newId)) {
7574
return newId
7675
}
77-
i++
7876
}
77+
//Fallback
78+
return `${baseId}_copy_${Date.now()}`
7979
}, [])
8080

8181
// Helper function to synchronize state updates between context and ReactFlow

0 commit comments

Comments
 (0)