mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-15 00:16:46 +00:00
fix(graphrag): graph view rendered blank — measure container after load
The ResizeObserver/size effect ran once on mount with [] deps while loading=true, so containerRef was null (the graph container isn't in the DOM yet) and size.width stayed 0, gating out ForceGraph2D (blank canvas) even though the data loaded. Re-run the measure effect on [loading, data.nodes.length] so it attaches + measures once the container actually mounts.
This commit is contained in:
1 parent
7e7f34ee9c
commit
91d17694b3
1 file changed
+1
-1
@@ -78,7 +78,7 @@ const GraphView: React.FC<GraphViewProps> = ({
|
||||
observer.observe(element);
|
||||
setSize({ width: element.clientWidth, height: 480 });
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
}, [loading, data.nodes.length]);
|
||||
|
||||
const maxNodeDegree = useMemo(() => maxDegree(data.nodes), [data.nodes]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user