From 881f7b74e504940abe66ef76f3da4de548b62a1f Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Mon, 15 Sep 2025 20:20:15 +0200 Subject: [PATCH] fix graph delete&revert --- static/js/graph.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/static/js/graph.js b/static/js/graph.js index fb5881c..caaa90a 100644 --- a/static/js/graph.js +++ b/static/js/graph.js @@ -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