Remove unused initAttemptedRef from GraphViewer

This commit is contained in:
yangdx
2025-03-19 13:23:45 +08:00
parent 6aab0eaea2
commit d7dfc914a4

View File

@@ -108,7 +108,6 @@ const GraphEvents = () => {
const GraphViewer = () => { const GraphViewer = () => {
const [sigmaSettings, setSigmaSettings] = useState(defaultSigmaSettings) const [sigmaSettings, setSigmaSettings] = useState(defaultSigmaSettings)
const sigmaRef = useRef<any>(null) const sigmaRef = useRef<any>(null)
const initAttemptedRef = useRef(false)
const selectedNode = useGraphStore.use.selectedNode() const selectedNode = useGraphStore.use.selectedNode()
const focusedNode = useGraphStore.use.focusedNode() const focusedNode = useGraphStore.use.focusedNode()
@@ -125,20 +124,12 @@ const GraphViewer = () => {
// Handle component mount/unmount and tab visibility // Handle component mount/unmount and tab visibility
useEffect(() => { useEffect(() => {
// When component mounts or tab becomes visible
if (isGraphTabVisible && !isFetching && !initAttemptedRef.current) {
initAttemptedRef.current = true
console.log('GraphViewer is visible')
}
return () => { return () => {
if (!isGraphTabVisible) { // Only log, keep everything untouched
// Only log cleanup, don't actually clean up the WebGL context
// This allows the WebGL context to persist across tab switches // This allows the WebGL context to persist across tab switches
console.log('GraphViewer is invisible, WebGL context is persisting') console.log('GraphViewer is invisible, WebGL context is persisting')
} }
} }, [isGraphTabVisible])
}, [isGraphTabVisible, isFetching])
// Initialize sigma settings once on component mount // Initialize sigma settings once on component mount
// All dynamic settings will be updated in GraphControl using useSetSettings // All dynamic settings will be updated in GraphControl using useSetSettings