MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / getUniqueNodeId

Function getUniqueNodeId

packages/ui/src/utils/genericHelper.js:4–17  ·  view source on GitHub ↗
(nodeData, nodes)

Source from the content-addressed store, hash-verified

2import moment from 'moment'
3
4export const getUniqueNodeId = (nodeData, nodes) => {
5 let suffix = 0
6
7 // Construct base ID
8 let baseId = `${nodeData.name}_${suffix}`
9
10 // Increment suffix until a unique ID is found
11 while (nodes.some((node) => node.id === baseId)) {
12 suffix += 1
13 baseId = `${nodeData.name}_${suffix}`
14 }
15
16 return baseId
17}
18
19export const getUniqueNodeLabel = (nodeData, nodes) => {
20 if (nodeData.type === 'StickyNote') return nodeData.label

Callers 3

duplicateNodeFunction · 0.90
CanvasFunction · 0.90
AgentflowCanvasFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected