I have 3 cells. When the combined_nodes function run once, the array keeps generating and appending to the nodes variable. I just only need to generate it once every time I execute the function. Why does this keep happening.
function combined_nodes(source, target) {
let unique_nodes = [...new Set([...source, ...target])].map(node => ({ id: node }));
mutable nodes = [...mutable nodes, ...unique_nodes]
console.log(unique_nodes)
console.log(nodes)
console.log("generated nodes from source and target")
}
mutable nodes = []
combined_nodes(distinctSource, distinctTarget)