Improve graph state cleanup by fully resetting sigma instance on label change
• Modify reset logic to clear sigma instance • Remove manual node deletion • Update GraphLabels to use reset() • Simplify state cleanup process • Ensure complete graph refresh
This commit is contained in:
@@ -111,13 +111,8 @@ const GraphLabels = () => {
|
||||
// Clear current graph data to ensure complete reload when label changes
|
||||
if (newLabel !== currentLabel) {
|
||||
const graphStore = useGraphStore.getState();
|
||||
graphStore.clearSelection();
|
||||
|
||||
// Reset the graph state but preserve the instance
|
||||
if (graphStore.sigmaGraph) {
|
||||
const nodes = Array.from(graphStore.sigmaGraph.nodes());
|
||||
nodes.forEach(node => graphStore.sigmaGraph?.dropNode(node));
|
||||
}
|
||||
// 完全重置图形状态
|
||||
graphStore.reset();
|
||||
}
|
||||
|
||||
if (newLabel === currentLabel && newLabel !== '*') {
|
||||
|
Reference in New Issue
Block a user