Fix linting

This commit is contained in:
yangdx
2025-03-15 14:47:21 +08:00
parent c5362d90e8
commit 1d4b0242e8
4 changed files with 14 additions and 17 deletions

View File

@@ -48,24 +48,21 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
*/
useEffect(() => {
if (sigmaGraph && sigma) {
// 确保 sigma 实例内部的 graph 引用被更新
// Ensure sigma binding to sigmaGraph
try {
// 尝试直接设置 sigma 实例的 graph 引用
if (typeof sigma.setGraph === 'function') {
sigma.setGraph(sigmaGraph as unknown as AbstractGraph<NodeType, EdgeType>);
console.log('Directly set graph on sigma instance');
console.log('Binding graph to sigma instance');
} else {
// 如果 setGraph 方法不存在,尝试直接设置 graph 属性
(sigma as any).graph = sigmaGraph;
console.log('Set graph property on sigma instance');
console.warn('Simgma missing setGraph function, set graph property directly');
}
} catch (error) {
console.error('Error setting graph on sigma instance:', error);
}
// 应用布局
assignLayout();
console.log('Layout applied to graph');
console.log('Initial layout applied to graph');
}
}, [sigma, sigmaGraph, assignLayout, maxIterations])