Hello,
I am trying to remove a node but currently when I run dia.model.removeNodeData(parentNode) I see that the nodeData is still there. I checked in the console logs and the data is the exact same with the exception that nodeDataArray has a property _gohasid where the parentNode does not have that. I tried to remove with parentNode.key but that didn’t work either. Can you help me figure out what I am doing wrong in trying to remove the node?
dia.addDiagramListener("SelectionDeleted", (e) => {
e.subject.each((node: go.Node) => {
const removedNode = node.data; // verified and accurate
const parentNode = this.diagramState.nodeDataArray.find(n => n.key === removedNode?.subGraphKey); //verified and accurate
const hasSiblings = this.hmiDiagramComponent?.diagram.model.nodeDataArray.some(n => n.subGraphKey === removedNode.subGraphKey); // verified and accurate
if(!hasSiblings && parentNode){
//correctly entering the if statement
dia.model.removeNodeData(parentNode); //parentNode is not being deleted.
}
})
});