Closed generic-github-user closed 5 years ago
Cloned networks have the same node IDs.
The cloned network connection source and destination properties do not reference nodes from the same network.
These nodes the connections reference and the nodes stored in the network node list may get separated during the cloning process.
Is it too late for an immutable data structure?
The references to the node objects are being divided when JSON.stringify()
is used.
We could still use the network constructor to create new clean copies of networks, then fill in their values . . .
Matching the connection source and destinations up to the correct nodes would be extremely painful.
Unfortunately, I think that most cloning methods (including deep cloning) will cause this issue - they aren't meant for complex objects with internal references.
If there were no references, node IDs could be used to store which nodes are connected to which other nodes without storing references to the node object itself in the connections . . . this would probably run somewhat slower, though - and each network's nodes would have to have a different set of UUIDs.
Everything works now, yay.
Node IDs match.