fix graph delete&revert
This commit is contained in:
		
							parent
							
								
									c347581a6c
								
							
						
					
					
						commit
						881f7b74e5
					
				@ -1381,10 +1381,10 @@ class GraphManager {
 | 
				
			|||||||
                forensicAnalysis: historyData.forensicAnalysis
 | 
					                forensicAnalysis: historyData.forensicAnalysis
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
        } else {
 | 
					        } 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");
 | 
					            console.log("Reverting UI changes due to backend failure");
 | 
				
			||||||
            this.nodes.add(historyData.nodes);
 | 
					            this.nodes.update(historyData.nodes);
 | 
				
			||||||
            this.edges.add(historyData.edges);
 | 
					            this.edges.update(historyData.edges);
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
                success: false,
 | 
					                success: false,
 | 
				
			||||||
@ -1531,9 +1531,9 @@ class GraphManager {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
                    if (result.success) {
 | 
					                    if (result.success) {
 | 
				
			||||||
                        console.log('Delete action reverted successfully on backend.');
 | 
					                        console.log('Delete action reverted successfully on backend.');
 | 
				
			||||||
                        // Re-add all nodes and edges from the history to the local view
 | 
					                        // Re-add all nodes and edges from the history to the local view - use update instead of add
 | 
				
			||||||
                        this.nodes.add(lastAction.data.nodes);
 | 
					                        this.nodes.update(lastAction.data.nodes);
 | 
				
			||||||
                        this.edges.add(lastAction.data.edges);
 | 
					                        this.edges.update(lastAction.data.edges);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        console.error('Failed to revert delete action on backend:', result.error);
 | 
					                        console.error('Failed to revert delete action on backend:', result.error);
 | 
				
			||||||
                        // Push the action back onto the history stack if the API call failed
 | 
					                        // Push the action back onto the history stack if the API call failed
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user