it's still logging the deleted node,
so the previous code that i send was for graph validation and if the graph is invalid then all of it will be deleted. now when i press a button, i want to initiate the validation and then the tranformation process. but since the nodes array still contain the invalid graph node then the invalid graph will be translated. if the validation and translation are on different button then it works fine but i want to automate it to make it simpler.
the code that i tried :
const validation = () => {
var nodes = [...this.state.diagram.nodes];
var links = [...this.state.diagram.links];
//Tried this
// this.state.diagram.clearAll();
// And this
for (var i = nodes.length - 1; i >= 0; i--) {
this.state.diagram.removeItem(nodes[i]);
console.log('node deleted'
}
console.log(nodes);
links.forEach((link) => {});
// console.log(nodes.content.fileName);
};
const CAEToGSN = () => {
const nodes = [...this.state.diagram.nodes];
const links = [...this.state.diagram.links];
nodes.forEach((node) => {
validation()
}
nodes.forEach((node) => {
//....Transformation Process
}
}
but they still log the deleted node, i think it might be bacause of the state? but i can't really figure out how to work around it.
so below is a couple image for reference, the first is the validation log, the second is the nodes before i translate and the third one is after i translate, when a node is deleted the link got deleted but not the node, i'm confused