fix graph delete&revert

This commit is contained in:
overcuriousity 2025-09-15 20:20:15 +02:00
parent c347581a6c
commit 881f7b74e5

View File

@ -1381,10 +1381,10 @@ class GraphManager {
forensicAnalysis: historyData.forensicAnalysis
};
} else {
// Revert UI changes if backend operations failed
// Revert UI changes if backend operations failed - use update instead of add
console.log("Reverting UI changes due to backend failure");
this.nodes.add(historyData.nodes);
this.edges.add(historyData.edges);
this.nodes.update(historyData.nodes);
this.edges.update(historyData.edges);
return {
success: false,
@ -1531,9 +1531,9 @@ class GraphManager {
if (result.success) {
console.log('Delete action reverted successfully on backend.');
// Re-add all nodes and edges from the history to the local view
this.nodes.add(lastAction.data.nodes);
this.edges.add(lastAction.data.edges);
// Re-add all nodes and edges from the history to the local view - use update instead of add
this.nodes.update(lastAction.data.nodes);
this.edges.update(lastAction.data.edges);
} else {
console.error('Failed to revert delete action on backend:', result.error);
// Push the action back onto the history stack if the API call failed